Nominate our 2022 Qt Champions!

[SOLVED] MinGW 4.6 Building Qt\4.8.4: ld.exe out of memory allocating .............. bytes

  • Hello!

    I've read a lot around here and there about failure installing Qt versions with MinGW, and I have the same problem: when building QtGui my compiler runs out of memory (did it with MinGW 4.6 and Qt 4.8.4 in Vista under debug and release). I understood, correct me if I'm wrong, that this is a linker problem. Having read that ld.exe has two options: --no-keep-memory and --large-adress-aware, I was wondering how could I pass these options from mingw32-make to try a rebuild (is this possible anyway? or how does this compiling-linking process work?)

    Moreover, these two options are "ld: emulation specific options:" What does this mean? Aren't they "normal" options?

    And finally: when specifying mingw32-make to keep going even if errors occurred, QtGui release library was successfully created, strange or not?

    I didn't want to be repetitive about this matter, but I didn't found a satisfactory answer (or looked at the wrong places...)

    Thanks in advance!

  • How did you configure the build?
    Did you use mkspecs\win32-g++-4.6 settings for compilation?

  • Try a different MinGW distribution (for example "mingw-builds":

    From one's own experience I can tell you that most 'out of memory' problems are results of memory leaks or bugs in the linker, not insufficient memory.

  • @koahnig

    bq. Did you use mkspecs\win32-g++-4.6 settings for compilation?

    Hey, thanks to that I realized in mkspecs folder there were two possible options: mkspecs\win32-g++ and mkspecs\win32-g++4.6. Then I looked to my QMAKESPEC variable and found it was set to win32-g++ (hope this was done by default). The difference is that the qmake.conf for 4.6 adds a -fno-keep-inline-dllexport to the win32-g++ qmake.conf's file. Sounds great.

    I'm gonna try to build it with -platform win32-g++4.6 and lets see what happens. If not I'll try what Lukas said.

    Looking forward to success!

  • Just to provide the complete information on this discussion.

    I have successfully compiled Qt 4.8.3 a while ago using MinGW 4.6.2 with the mkspecs\win32-g++4.6 settings. This is on Windows 7 64 bit.

    Lateron I could compile successfully also on another machine Qt 4.8.4 with mkspecs\win32-g++4.6 and MinGW 4.7.2 (also Win7 64 bit).

    I have used MinGW 32 bit versions only. They have been downloaded from directly. As you can see from the discussions in "this thread": it is most likely not the best choice, especially when coming to 64 bit version.

  • Hi!

    Sorry for the delay guys! I managed to do it correctly (it is still compiling, right now it has taken 5 hours!) I did what you said koahnig, but didn't work. The same happened with other MinGW version, sorry Lukas (I have another question about this anyway, but first things first).

    As the only place where mingw32-make crashed was on the Makefile of QtGuid4.dll, I opened the Makefile.Debug of gui's project and modified it slightly (after configure.exe finished). I read that with the -Wl option, g++ compiler links with ld.exe (read the help for more info). The commands following -Wl are just options for ld.exe.

    So in the Makefile.Debug where it is written

    @LFLAGS = -mthreads -shared -Wl,--out-implib,c:\Qt\4.8.4\lib\libQtGuid4.a@

    I completed it with

    @LFLAGS = -mthreads -shared -Wl,--out-implib,c:\Qt\4.8.4\lib\libQtGuid4.a,--large-address-aware,--no-keep-memory@

    Now I have my QtGuid4.dll created in Qt\4.8.4\lib folder and everything is going right. Just got one warning, but I think it can be ignored:

    JavaScriptCore/wtf/NullPtr.h:48:1: warning: identifier 'nullptr' will become a keyword in C++0x [-Wc++-compat]

    Now my final question: I can't remember where I downloaded my MinGW, but could it be that for the same version (for example 4.6) we could have different binaries produced from different but similar code? (Just as they are free software?) I can't find any other reason to explain why it succeeded to you and not to me :( Don't think this is a bug.

    Thanks for your time guys! I'll mark it as solved! (but please, answer my last question ;) )

    Best regards

  • Hello, I've similar problem when i compile QT 4.8.4 and mingw 4.4.

    @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.4/src/gui'
    mingw32-make[1]: *** [debug-all] Error 2
    mingw32-make[1]: Leaving directory 'C:/Qt/4.8.4/src/gui'
    mingw32-make: *** [sub-gui-make_default-ordered] Error 2@

    I'm new user with QT and i don't find makefile.debug to open and make your soluce. Where is it please?

  • @fbertran

    Hello, you can find it in your Qt directory in: Qt\4.8.4\src\gui


Log in to reply