Default configuration throws out of memory error
-
Hi all,
I've been struggling with this for some time and haven't found or don't understand the solutions out there. I thought it might be time to ask the forum specifically. So this has been my procedure from a fresh Windows 7 64-bit install (and re-extracting Qt several times after failed attempts):
Downloaded and installed latest MinGW from http://sourceforge.net/projects/mingw/files/latest/download?source=files
Downloaded Qt 4.8.2 from http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.2.zip
MinGW is installed at C:\MinGW\ and Qt is extracted to C:\Qt\4.8.2. I changed my user environment variables:
INCLUDE -- C:\MinGW\include;C:\Qt\4.8.2\include
LIB -- C:\MinGW\lib;C:\Qt\4.8.2\lib
PATH -- C:\MinGW\bin;C:\Qt\4.8.2\bin
QMAKESPEC -- win32-g++
QTDIR -- C:\Qt\4.8.2In C:\MinGW\bin I made a make.bat file that calls mingw32-make.
Next I go to C:\Qt\4.8.2 and call configure:
@configure -platform win32-g++ -opensource@
That works fine. Next I call make:
It compiles for a pretty long time and then gets to this command:
@g++ -mthreads -shared -Wl,--out-implib,c:\Qt\4.8.2\lib\libQtGuid4.a -o ....\lib\QtGuid4.dll object_script.QtGuid.Debug -L"c:\Qt\4.8.2\lib" -L"c:\MinGW\lib" -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32 tmp\obj\debug_shared\QtGuid_resource_res.o -lmsimg32 -lshell32 -lQtCored4@which throws this error:
@c:/mingw/bin/../lib/gcc/ming32/4.7.0/../../../../mingw32/bin/ld.exe: out of memory allocating 133619352 bytes
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [....\lib\QtGuid4.dll] Error 1
mingw32-make[2]: Leaving directory 'C:/Qt/4.8.2/src/gui'
mingw32-make[1]: *** [debug-all] Error 2
mingw32-make[1]: Leaving directory 'C:/Qt/4.8.2/src/gui'
mingw32-make: *** [sub-gui-make_default-ordered] Error 2@I have 8 GB of RAM installed so I don't really understand how that isn't enough. If I look at windows task manager memory usage, I have about 2.5 GB in use before running make. It gets to that instruction and over about 5 minutes it slowly consumes 2 GB of memory (leaving several GB of memory left) and then tosses that error and releases everything used. I've tried to find solutions online. I've found a suggestion to add
@-fno-keep-inline-dllexport@
compiler option and to rebuild it. I don't understand where that goes. I've tried adding it to configure, make, other places, etc.
Any help would be greatly appreciated. I've spent too much time trying to figure out this whole build system. It seemed so easy when I started!
And just in case someone feels like teaching this newb a bit: I'm interested in using eclipse and have the eclipse integration up and running. Previously when using Qt I've had problems with the debugger just tossing a thread ID and then stopping. Since I'm on a fresh install I was trying to fix that. I think my ideal configuration would be:
@configure -debug-and-release -static -platform win32-g++ -opensource -no-qt3support@
In the end I want to statically link the library to my app. I'm guessing in development I should really just stick with -shared and once I've got my app finished switch over to a statically built version? Also, I realize I should be able to debug my app while still linking to the release version of Qt. It just seems to not work correctly in Eclipse as previously mentioned, so I thought I should build the debug versions as well. The problem with that was it filled up 50 GB of space over many hours and stopped when it ran out of space. It was pretty much just all in the examples directory. I'm guessing since I statically linked and had debug on, all the examples blew up in size. So I should probably just do a configure -release -static but exclude the examples directory, etc. Can someone possibly comment on that?
Thanks a ton and I'm sorry this post is so long! If you've read this far I am completely indebted to you already! Thanks! And I apologize for any typos in the commands from moving them from CMD; I've fixed several in the post already.
Jacob
-
I dont build qt with mingw myself,
but if your having Visual Studio on the machine as well I can give you the build process I use which seems to be fine.
On a sidenote:
you mention your desire to static link Qt. The static and debug linking against licensing is a pretty confusing aspect tbh.
There are plenty of posts abt the same question. You might want to have a read through them so you dont start off with one direction and are forced to switch later on.
My understanding is: (If you dont want to release your source code for the GUI)
Static: Get Qt Commercial License from Digia to develop per developer. They will provide a quote on request. (This allows building & linking Qt libraries statically)
Dynamic: LGPL so free to use in commercial apps even with your source-code not released.
One catch with static is webkit for one is a LGPL license as well so getting Qt commercial license would not allow us using webkit(from apple) static and I think Qt does not even let you build webkit if you try a static build
-
Ah good to know, thanks. It looks like I'll be doing shared linking then!
-
np and if your building shared libraries, you can always use the qt installers as well :)
saves you having to go thru mingw
and if you do have visual studio, I can give you the build process from src for tht which I use.
-
Yeah I can get Visual Studio. At this point I am up for anything that gets me past this error. Thanks.
-
Sorry I forgot to add I tried using the library installer. The installation works fine, but it doesn't include the debug build during the install. There is a script included for automatically compiling the debug build, but that has also failed with a different error. I posted that error in a different thread (http://qt-project.org/forums/viewthread/17981/#88627). I was told to try compiling from the source, so that's where I'm at now.
[quote author="klox" date="1339678175"]I just ran into this error too. I am downloading the Qt libraries install, not the whole SDK. I was planning on using Eclipse + Qt plugin so I didn't think the whole SDK was necessary. Is that incorrect?
After installing Qt libraries I have the folder c:\Qt\4.8.2. Under the start menu there is a folder Qt by Nokia v4.8.2 (MinGW OpenSource). Inside there are the following: Assistant, Designer, Examples and Demos, Linguist, Qt 4.8.2 (Build Debug Libraries), Qt 4.8.2 Command Prompt, Qt Readme, qt.digia.com, Uninstall
So that is what the OP was using (the build debug libraries). I also saw from tutorials to use that after defining relevant environment variables. Executing that eventually gave me two different errors:
- Maybe about 30-40 minutes in it tries to use ld.exe and throws an "out of memory" error. I got this several times until I restarted my computer and I think it's successfully passed this point.
@g++ -Wl -subsystem,console -mthreads -o ......\bin\uic3.exe object_script.uic3.Debug -L"c:\Qt\4.8.2\lib" -L"c:\MinGW\lib" -L"c:\Qt\4.8.2\lib" -L"c:\Qt\4.8.2\lib" -lQt3Supportd4 -lQtXmld4 -lQtGuid4 -lQtCored4
mingw32-make[2]: Leaving directory 'c:/Qt/4.8.2/src/toools/uic3'
mingw32-make[2]: Leaving directory 'c:/Qt/4.8.2/src/toools/uic3'
mingw32-make: *** No rule to make target 'src_tools_idc-sub_Debug', needed by 'sub-activeqt-sub_Debug'. Stop.@So I guess my question is how to make sure the debug version of the libraries were finished compiling. Should I instead be using the SDK and just not installing all the extra stuff? I was a bit confused because it was creating some pretty large directory structures and I felt like I wasn't figuring out how to correctly link everything together. The Qt libraries install seems much more straight forward, except for these compiler errors ;)
Thanks![/quote]
-
The steps I use for building with Visual Studio(2010):
You need to download Windows SDK as well just from microsoft website if you dont have itThis is for x86 (If your running on x64 let me know cos there are few things in the following to change)
First create a batch file with the following in it
@
@echo OFFset QtDir=C:\qt-everywhere-opensource-src-4.8.2
set WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v7.1
set MsvcDir=C:\Program Files\Microsoft Visual Studio 10.0set PATH=%PATH%;%QtDir%\bin;"%MsvcDir%\VC\bin";"%MsvcDir%\Common7\IDE";"%WindowsSdkDir%\Bin"
set LIB="%WindowsSdkDir%\\Lib";%LIB%
set INCLUDE="%WindowsSdkDir%\\Include";%INCLUDE%
set TARGET_CPU=x86echo Environment ready.
title Qt Framework 4.8 Development Kit.
cd %QtDir%
@First Three Lines you might need to update:
set QtDir= "Path to the root of your qt source files dir"
set WindowsSdkDir= "Windows SDK Dir Path"
set MsvcDir= "MSVC Dir Path" \VCBatch file can be anywhere. once created, run it from a Visual Studio Command prompt not native cmd.exe
Then copy paste into same VS command prompt each line and run:
- configure -release -opensource -confirm-license -shared -platform win32-msvc2010 -ltcg
- nmake
- nmake confclean
- configure -debug -opensource -confirm-license -shared -platform win32-msvc2010
- nmake
Thats it!!!
DLL's will be in "Qt Source Folder"\bin
move them to your app executable folder and your sorted :)
Each nmake command would take abt 1-2hrs based on your machine. so gonna be a while. You can give particular configure commands if needed and also build only particular sub-modules with nmake to make building faster, however I think right now your looking to just get it built than try more tweaks.
EDIT:
Code Formatter puts a double \ for some reason in some places.
The following two lines should be like this in the batch file. no double \ only single \
set LIB="%WindowsSdkDir%\\Lib";%LIB%
set INCLUDE="%WindowsSdkDir%\\Include";%INCLUDE% -
I have similar errors with executing make.exe in the MinGW environment (MSYS). It works for me, once I use mingw32-make.exe.
-
Hi Volker,
I haven't used MSYS, but I've been using mingw32-make.exe from the smaller mingw install by either just copying it to make.exe or making a make.bat that points to mingw32-make.exe. Is there a separate MSYS make program?
-
I did not use the MinGW environment offered by the Qt installers, but installed it from scratch from their website. MSYS is a unix like command line terminal, including bash etc.
-
Ok thanks. I've been using the get installer from the mingw website. I'll add MSYS and try compiling it through that terminal.
-
For gosh sake...answer the OP's question!
Add -fno-keep-inline-dllexport to the mkspec file for win32-g++. It should be located somewhere like:
C:\Qt\4.8.3\mkspecs\win32-g++\qmake.conf
Look for a variable called QMAKE_CXXFLAGS and add it there.
Chris
[quote author="klox" date="1340715915"]Hi all,
I've been struggling with this for some time and haven't found or don't understand the solutions out there. I thought it might be time to ask the forum specifically. So this has been my procedure from a fresh Windows 7 64-bit install (and re-extracting Qt several times after failed attempts):
Downloaded and installed latest MinGW from http://sourceforge.net/projects/mingw/files/latest/download?source=files
Downloaded Qt 4.8.2 from http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.2.zip
MinGW is installed at C:\MinGW\ and Qt is extracted to C:\Qt\4.8.2. I changed my user environment variables:
INCLUDE -- C:\MinGW\include;C:\Qt\4.8.2\include
LIB -- C:\MinGW\lib;C:\Qt\4.8.2\lib
PATH -- C:\MinGW\bin;C:\Qt\4.8.2\bin
QMAKESPEC -- win32-g++
QTDIR -- C:\Qt\4.8.2In C:\MinGW\bin I made a make.bat file that calls mingw32-make.
Next I go to C:\Qt\4.8.2 and call configure:
@configure -platform win32-g++ -opensource@
That works fine. Next I call make:
It compiles for a pretty long time and then gets to this command:
@g++ -mthreads -shared -Wl,--out-implib,c:\Qt\4.8.2\lib\libQtGuid4.a -o ....\lib\QtGuid4.dll object_script.QtGuid.Debug -L"c:\Qt\4.8.2\lib" -L"c:\MinGW\lib" -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32 tmp\obj\debug_shared\QtGuid_resource_res.o -lmsimg32 -lshell32 -lQtCored4@which throws this error:
@c:/mingw/bin/../lib/gcc/ming32/4.7.0/../../../../mingw32/bin/ld.exe: out of memory allocating 133619352 bytes
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [....\lib\QtGuid4.dll] Error 1
mingw32-make[2]: Leaving directory 'C:/Qt/4.8.2/src/gui'
mingw32-make[1]: *** [debug-all] Error 2
mingw32-make[1]: Leaving directory 'C:/Qt/4.8.2/src/gui'
mingw32-make: *** [sub-gui-make_default-ordered] Error 2@I have 8 GB of RAM installed so I don't really understand how that isn't enough. If I look at windows task manager memory usage, I have about 2.5 GB in use before running make. It gets to that instruction and over about 5 minutes it slowly consumes 2 GB of memory (leaving several GB of memory left) and then tosses that error and releases everything used. I've tried to find solutions online. I've found a suggestion to add
@-fno-keep-inline-dllexport@
compiler option and to rebuild it. I don't understand where that goes. I've tried adding it to configure, make, other places, etc.
Any help would be greatly appreciated. I've spent too much time trying to figure out this whole build system. It seemed so easy when I started!
And just in case someone feels like teaching this newb a bit: I'm interested in using eclipse and have the eclipse integration up and running. Previously when using Qt I've had problems with the debugger just tossing a thread ID and then stopping. Since I'm on a fresh install I was trying to fix that. I think my ideal configuration would be:
@configure -debug-and-release -static -platform win32-g++ -opensource -no-qt3support@
In the end I want to statically link the library to my app. I'm guessing in development I should really just stick with -shared and once I've got my app finished switch over to a statically built version? Also, I realize I should be able to debug my app while still linking to the release version of Qt. It just seems to not work correctly in Eclipse as previously mentioned, so I thought I should build the debug versions as well. The problem with that was it filled up 50 GB of space over many hours and stopped when it ran out of space. It was pretty much just all in the examples directory. I'm guessing since I statically linked and had debug on, all the examples blew up in size. So I should probably just do a configure -release -static but exclude the examples directory, etc. Can someone possibly comment on that?
Thanks a ton and I'm sorry this post is so long! If you've read this far I am completely indebted to you already! Thanks! And I apologize for any typos in the commands from moving them from CMD; I've fixed several in the post already.
Jacob [/quote]
-
I don't know if its too late for this post.
At first I had the same problem (now I'm using qtcreator 2.6.0), and looked for some info in the internet, but then took a look on the tools menu/Options: kits, Qt Versions & Compilers. There I specified the mingw path, qmake's path, the 4.8.4 version's directory, added the gcc mingw compiler's path and suddenly everything went right! I could compile GUI applications and it seems there are no bugs!
I'll make sure, but for now it works fine for some simple applications I created.
Best regards and may the Qt be with you.
-
Well, this is interesting... I've seen that with the mingw32-make crash the qtgui4.dll is not generated in C:\Qt\4.8.4\lib, so I cannot execute the .exe outside Qt. But why is it possible to do it inside qtcreator? I can build and run without problems.
Does anybody knows?
Thanks
-
Maybe -fno-keep-inline-dllexport is not enough. "Look here":https://qt-project.org/forums/viewthread/23623/
Regards