Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Default configuration throws out of memory error
Forum Updated to NodeBB v4.3 + New Features

Default configuration throws out of memory error

Scheduled Pinned Locked Moved Installation and Deployment
15 Posts 5 Posters 11.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    klox
    wrote on 26 Jun 2012, 13:05 last edited by
    #1

    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.2

    In 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:

    @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

    1 Reply Last reply
    0
    • N Offline
      N Offline
      Nosf
      wrote on 27 Jun 2012, 11:43 last edited by
      #2

      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

      1 Reply Last reply
      0
      • K Offline
        K Offline
        klox
        wrote on 27 Jun 2012, 12:03 last edited by
        #3

        Ah good to know, thanks. It looks like I'll be doing shared linking then!

        1 Reply Last reply
        0
        • N Offline
          N Offline
          Nosf
          wrote on 27 Jun 2012, 12:06 last edited by
          #4

          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.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            klox
            wrote on 27 Jun 2012, 12:24 last edited by
            #5

            Yeah I can get Visual Studio. At this point I am up for anything that gets me past this error. Thanks.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              klox
              wrote on 27 Jun 2012, 12:33 last edited by
              #6

              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:

              1. 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]

              1 Reply Last reply
              0
              • N Offline
                N Offline
                Nosf
                wrote on 27 Jun 2012, 13:54 last edited by
                #7

                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 it

                This 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 OFF

                set 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.0

                set 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=x86

                echo 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" \VC

                Batch 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:

                1. configure -release -opensource -confirm-license -shared -platform win32-msvc2010 -ltcg
                2. nmake
                3. nmake confclean
                4. configure -debug -opensource -confirm-license -shared -platform win32-msvc2010
                5. 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%

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on 1 Jul 2012, 12:57 last edited by
                  #8

                  I have similar errors with executing make.exe in the MinGW environment (MSYS). It works for me, once I use mingw32-make.exe.

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    klox
                    wrote on 1 Jul 2012, 21:27 last edited by
                    #9

                    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?

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on 1 Jul 2012, 21:29 last edited by
                      #10

                      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.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        klox
                        wrote on 1 Jul 2012, 21:40 last edited by
                        #11

                        Ok thanks. I've been using the get installer from the mingw website. I'll add MSYS and try compiling it through that terminal.

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          cspringer
                          wrote on 24 Sept 2012, 15:47 last edited by
                          #12

                          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.2

                          In 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:

                          @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]

                          1 Reply Last reply
                          0
                          • Q Offline
                            Q Offline
                            QMartin
                            wrote on 16 Dec 2012, 20:18 last edited by
                            #13

                            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.

                            1 Reply Last reply
                            0
                            • Q Offline
                              Q Offline
                              QMartin
                              wrote on 17 Dec 2012, 08:33 last edited by
                              #14

                              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

                              1 Reply Last reply
                              0
                              • Q Offline
                                Q Offline
                                QMartin
                                wrote on 12 Jan 2013, 01:05 last edited by
                                #15

                                Maybe -fno-keep-inline-dllexport is not enough. "Look here":https://qt-project.org/forums/viewthread/23623/

                                Regards

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved