[Solved] Installing Qt 4.8.2 from sources using MinGW 4.7.x



  • Hi

    I configured makefile using this command:
    @.\configure.exe -opensource -plugin-sql-mysql -plugin-sql-sqlite -plugin-sql-odbc -developer-build -no-qt3support -platform win32-g++ -I C:\ApacheMysqlPhp\Mysql\include -L C:\ApacheMysqlPhp\Mysql\lib -L C:\ApacheMysqlPhp\Mysql\lib\opt
    @

    and then executed make.exe (make.exe is the same file as mingw32-c++.exe, mingw32-gcc.exe, mingw32-g++.exe etc.). However in the middle, the process stopped with this log:
    @c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe: final link failed: Memory exhausted
    collect2.exe: error: ld returned 1 exit status
    make[2]: *** [....\lib\QtGuid4.dll] Error 1
    make[2]: Leaving directory C:/Qt/4.8.2/src/gui' make[1]: *** [debug-all] Error 2 make[1]: Leaving directoryC:/Qt/4.8.2/src/gui'
    make: *** [sub-gui-make_default-ordered] Error 2@

    I have windows 7 64bit. Why is there this error?



  • You are either running out of memory (the linking can require loads, loads of memory) or, and this happens on occasion, you are running into a linker bug.

    At first I would try a different toolchain build (there are plenty of MinGW builds like TDM, rubenvb, mingw-builds), a 64-bit version of the toolchain (it can be used to create 32-bit binaries as well) or, if this doesn't solve the problem, reduce the size of the resulting binary by using a debug build instead of a developer build, stripping unneccesary stuff like styles or alike or, finally, not building a debug build at all.


  • Moderators

    Lukas has covered most of your options. Your issue reminds me of a problem I had when doing the compilation of Qt. This was with a bit earlier versions, probably 4.5 or 4.6 on windows xp with msvc 2005. I am not sure at the moment if it was a desktop build or for windows ce. However, the configuration went smoothly, but the compilation crashed. I simply restarted the compilation and it continued.
    This certainly leaves a bit of an uncertainty, because you are not sure and there must be a reason. However, the applications did run smoothly. I could not find the problem. Fresh copies showed the same behaviour. I had to restart 2-3 times until the compilation and linking was finished.



  • Hi,

    I recently built Qt 4.8.1 with MinGW GCC 4.6.2 and also had some trouble when I used the platform win32-g++. Try to use the new platform win32-g++-4.6 for GCC compilers > 4.6. Here are my configuration options from configure.cache file:

    @-confirm-license
    -platform
    win32-g++-4.6
    -no-qt3support
    -qt-style-windows
    -qt-style-windowsxp
    -phonon
    -qt-style-windowsvista
    -plugin-sql-sqlite
    -plugin-sql-odbc
    -qt-zlib
    -qt-libpng
    -qt-libjpeg
    -qt-libtiff
    -qt-libmng
    -no-openssl
    -opensource
    -no-dsp
    -no-vcproj
    -no-incredibuild-xge
    -D
    _WIN32_WINNT=0x501 @



  • @Lucas
    I have downloaded the version of MinGW from their website and then sourceforge. I did not realize there would be more versions of MinGW. I will try to read about them, though. As to limiting the build to debug, release, or keep develop-build, what would be the difference if I decided to have debug or release version, or even both?

    @Uwe
    Hi, I tried to compile Qt with g++ -v 4.7.0. I did not try to do it again, though as I am going to give it a go with VC2010.

    I would have a general question. I want to try the msvc 2010 compiler but I am not sure if it's better than MinGW. I personally always prefer MinGW over MS VC because MinGW seems to be closer to standard of GNU C++. MS has always been tented to implement their own tricky "solutions" when it comes to details. I hope VC2010 is different now but the question still remains whether VC2010 is better. Also, I am not sure that if I build Qt via MSVC 2010, will my application sources still be platform independent.



  • Compiling Qt 4.8.2 with MinGW GCC4.7.0 should work properly with the configuration options I posted above. The problem is the platform you selected (win32-g++). You need to select win32-g++-4.6 in order to compile with GCC versions >= GCC 4.6. So you should try it again with the given configuration options.

    If you have the money to buy a VS2010 license there is nothing wrong with VS2010 and Qt. Especially if you want to develop GPU accelerated applications with Nvidia CUDA library VS2010 is the right choice because CUDA does not support MinGW compiler. If you develop cross platform, e.g. for Windows and Linux, then MinGW might be the right choice because you use the same toolchain for both systems (GCC).



  • [quote author="Zebbik" date="1345727364"]I have downloaded the version of MinGW from their website and then sourceforge. I did not realize there would be more versions of MinGW. I will try to read about them, though.[/quote]These are not exactly different versions, but rather the same version beeing built using a different toolchain, different compiler options and different dependencies. So if you run into a bug which is caused by a specific combination of the above chances are high that another build works.

    [quote author="Zebbik" date="1345727364"]As to limiting the build to debug, release, or keep develop-build, what would be the difference if I decided to have debug or release version, or even both?[/quote]A release build usually contains only code, optimizied for speed and size, a debug build additionally includes debug information which allows for (comfortable) debugging and bug tracking at the cost of decreased speed and increased size and a developer build is in principle an extended debug build, which basically allows for (automated) testing of Qt itself.



  • [quote author="Uwe Kindler" date="1345730525"]If you have the money to buy a VS2010 license there is nothing wrong with VS2010[/quote]The MSVC compiler comes for free as part of the Windows SDK and the Express Editions, what you pay for is Visual Studio.



  • Thanks Uwe,
    I'm sorry I miss the platform configuration you have specified "-platform win32-g++-4.6". I don't know why. I did not find it in the documentation as well.
    The main reason I am compiling Qt is that I need a functional plugin mysql and openssl. I have database put on server and I an application that can operate on this database. OpenSsl is not that important as mysql. I am not interested in CUDA and GPU accelerated applications at all. From what you have said, everything is on MinGW side :) Thanks for this post. I am really happy I can stick to MinGW. I will go and try GNU GCC with proper option specified. Hopefully, this time it will get through.



  • [quote author="Lukas Geyer" date="1345731383"]These are not exactly different versions, but rather the same version beeing built using a different toolchain, different compiler options and different dependencies. So if you run into a bug which is caused by a specific combination of the above chances are high that another build works.[/quote]I see. Now I know what I am dealing with. On the same website, there is a version of MinGW 4.4 availabel to download as well as the Qt sources. It seems to be that this version of MinGW might be "tuned" so that Qt can be built properly. I am not sure if it's the case, though.

    [quote author="Lukas Geyer" date="1345731383"]A release build usually contains only code, optimizied for speed and size, a debug build additionally includes debug information which allows for (comfortable) debugging and bug tracking at the cost of decreased speed and increased size and a developer build is in principle an extended debug build, which basically allows for (automated) testing of Qt itself.[/quote]I understand that if I am not going to test Qt itself, then I probably don't need -debug version. I do not even feel I would be of any help to find a bug, not on this stage i am afraid. Perhaps later :)

    Thank you



  • [quote author="Lukas Geyer" date="1345731538"]The MSVC compiler comes for free as part of the Windows SDK and the Express Editions, what you pay for is Visual Studio.
    [/quote]

    Visual Studio Express 11 does not support desktop applications but only metro applications:

    "http://www.golem.de/news/visual-studio-11-kostenlose-express-version-unterstuetzt-nur-metro-apps-1205-91989.html":http://www.golem.de/news/visual-studio-11-kostenlose-express-version-unterstuetzt-nur-metro-apps-1205-91989.html

    You still can use Visual Studio Express 10 but then you will not get the new C++ features that will be implemented for new compilers.



  • "No":http://blogs.msdn.com/b/visualstudio/archive/2012/06/08/visual-studio-express-2012-for-windows-desktop.aspx, Visual Studio Express 2012 has support for C++ for Desktop and Console applications.

    If you do not need Visual Studio the compiler suite is included in the Windows SDK 8 as well.

    And, well, there are no new C++ features in MSVC2012 except for some minor stuff like range-based for, strongly-typed enums and a bit of concurreny (mostly stuff that is already provided by Qt). Still no const expressions, no delegation, no constructor inheritance, no initializer lists, no non-static data-member initialization, no unicode literals, not even variadic templates.

    (Serious) C++11 means Intel, GCC or Clang. Forget about MSVC.



  • [quote author="Zebbik" date="1345732703"]On the same website, there is a version of MinGW 4.4 availabel to download as well as the Qt sources. It seems to be that this version of MinGW might be "tuned" so that Qt can be built properly. I am not sure if it's the case, though.[/quote]You don't need to bother with MinGW 4.4. It is outdated, broken and no longer supported as of Qt5. Go for MinGW 4.6.3+ or MinGW 4.7+ instead. I'm using the mingw-builds and I haven't had a problem so far with Qt 4.8+ and Qt 5.

    [quote author="Lukas Geyer" date="1345731383"]I understand that if I am not going to test Qt itself, then I probably don't need -debug version.[/quote]You will need a debug version of the libraries if you want to step into Qt itself when debugging your application (otherwise you'll be just dumped into a bunch of disassembly).

    So I strongly recommend building a debug version of Qt as well when you plan to build a debug version of your application. You should be theoretically able to link your debug application to a release Qt but experience has shown that this is really just theoretical.



  • I am glad you told me about debug. I was not aware of requiring it when it comes to debug my own applications and I'd probably build Qt without it.
    MinGW 4.4 is installed with QtSDK and I though I could change Path to this folder but if you say it's not a good idea then I'll try different toolchains as mentioned or change configuration with remaining MinGW 4.7.0 I have installed. Hope this time it 's going to work.

    Thanks
    Best wishes.



  • I am happy to say that after the whole night my comp finally built Qt 4.8.2 ^^ using MinGW 4.7.0. My previous projects from QtSDK work, QLocale, QTranslator work, QMYSQL work woohoo .... I am so happy. So far, so good.

    I genuinely say thank you for the help :)



  • You're welcome.

    One last hint: if you don't need Webkit skip building it (using <code>--no-webkit</code>). This greatly reduces compilation time.



  • In my opinion, this is a classic example of a failure to test and create the "correct" solution to the problem. The OP's problem is caused by code bloat from inlined functions. The easiest way to fix this problem is to pass -fno-keep-inline-dllexport as a compiler option. Ideally, the win32-g++ mkspec should be updated with this change. I worked on creating a patch for this problem this weekend but after patching and building Qt I got distracted by the multitude of problems I had building qt-creator. Beware if you move on to build creator, there are several bugs when building with win32 vs. win64. For example, on win32 builds, MIB_TCP_STATE will be undefined because of an incorrect preprocessor check for the version of GCC.

    Hopefully this will serve as a wake-up call for people to do more testing before pushing code and releasing immature versions.

    Chris

    [quote author="Zebbik" date="1345647851"]Hi

    I configured makefile using this command:
    @.\configure.exe -opensource -plugin-sql-mysql -plugin-sql-sqlite -plugin-sql-odbc -developer-build -no-qt3support -platform win32-g++ -I C:\ApacheMysqlPhp\Mysql\include -L C:\ApacheMysqlPhp\Mysql\lib -L C:\ApacheMysqlPhp\Mysql\lib\opt
    @

    and then executed make.exe (make.exe is the same file as mingw32-c++.exe, mingw32-gcc.exe, mingw32-g++.exe etc.). However in the middle, the process stopped with this log:
    @c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe: final link failed: Memory exhausted
    collect2.exe: error: ld returned 1 exit status
    make[2]: *** [....\lib\QtGuid4.dll] Error 1
    make[2]: Leaving directory C:/Qt/4.8.2/src/gui' make[1]: *** [debug-all] Error 2 make[1]: Leaving directoryC:/Qt/4.8.2/src/gui'
    make: *** [sub-gui-make_default-ordered] Error 2@

    I have windows 7 64bit. Why is there this error?
    [/quote]



  • [quote author="Zebbik" date="1345795721"]I am happy to say that after the whole night my comp finally built Qt 4.8.2 ^^ using MinGW 4.7.0. My previous projects from QtSDK work, QLocale, QTranslator work, QMYSQL work woohoo .... I am so happy. So far, so good.

    I genuinely say thank you for the help :)
    [/quote]

    Hi Zebbik,

    I'm also trying to update the MigGW compiler to the 4.7 version and keep working with QtSDK. I'm a beginner and I don't know much about how to compile Qt and configure QtCreator properly to work with it (not with the default MinGW 4.4)... Could you tell me more or less the steps you took to get it working?

    Thank you very much!!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.