August 22, 2012

Zebbik Zebbik
Lab Rat
25 posts

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

Page  
1

Hi

I configured makefile using this command:

  1. .\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:

  1. c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe: final link failed: Memory exhausted
  2. collect2.exe: error: ld returned 1 exit status
  3. make[2]: *** [..\..\lib\QtGuid4.dll] Error 1
  4. make[2]: Leaving directory `C:/Qt/4.8.2/src/gui'
  5. make[1]: *** [debug-all] Error 2
  6. make[1]: Leaving directory `C:/Qt/4.8.2/src/gui'
  7. make: *** [sub-gui-make_default-ordered] Error 2

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

17 replies

August 22, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

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.

August 22, 2012

koahnig koahnig
Area 51 Engineer
2879 posts

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.

August 23, 2012

Uwe Kindler Uwe Kindler
Lab Rat
68 posts

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:

  1. -confirm-license
  2. -platform
  3. win32-g++-4.6
  4. -qt-style-windows
  5. -qt-style-windowsxp
  6. -phonon
  7. -qt-style-windowsvista
  8. -plugin-sql-sqlite
  9. -plugin-sql-odbc
  10. -qt-zlib
  11. -qt-libpng
  12. -qt-libjpeg
  13. -qt-libtiff
  14. -qt-libmng
  15. -no-openssl
  16. -opensource
  17. -no-dsp
  18. -no-vcproj
  19. -no-incredibuild-xge
  20. -D
  21. _WIN32_WINNT=0x501

August 23, 2012

Zebbik Zebbik
Lab Rat
25 posts

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

August 23, 2012

Uwe Kindler Uwe Kindler
Lab Rat
68 posts

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

August 23, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

Zebbik wrote:
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.
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.

Zebbik wrote:
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?
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.

August 23, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

Uwe Kindler wrote:
If you have the money to buy a VS2010 license there is nothing wrong with VS2010
The MSVC compiler comes for free as part of the Windows SDK and the Express Editions, what you pay for is Visual Studio.

August 23, 2012

Zebbik Zebbik
Lab Rat
25 posts

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.

August 23, 2012

Zebbik Zebbik
Lab Rat
25 posts

Lukas Geyer wrote:
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.
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.

Lukas Geyer wrote:
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.
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

August 23, 2012

Uwe Kindler Uwe Kindler
Lab Rat
68 posts
Lukas Geyer wrote:
The MSVC compiler comes for free as part of the Windows SDK and the Express Editions, what you pay for is Visual Studio.

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 [golem.de]

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.

August 23, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

No [blogs.msdn.com], 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.

August 23, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

Zebbik wrote:
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.
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.

Lukas Geyer wrote:
I understand that if I am not going to test Qt itself, then I probably don’t need -debug version.
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.

August 23, 2012

Zebbik Zebbik
Lab Rat
25 posts

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.

August 24, 2012

Zebbik Zebbik
Lab Rat
25 posts

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

August 24, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

You’re welcome.

One last hint: if you don’t need Webkit skip building it (using —no-webkit). This greatly reduces compilation time.

Page  
1

  ‹‹ Mysql Plugin Strange Error      [SOLVED] Compiling Fortran code with gfortran within a C++ project ››

You must log in to post a reply. Not a member yet? Register here!