PDA

View Full Version : QMake for Linux x64 doesn't set -L/usr/lib64



PhilippM
19th April 2011, 09:58
Hi folks,

I need two custom local installations of Qt to build 32bit and 64bit applications on Linux. The Linux distribution itself is 64bit.

I compiled the 32bit QT as follows:

./configure -prefix /usr/local/Trolltech/Qt-4.7.2-32/ -opensource -fast -qt-sql-sqlite -no-qt3support -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-libpng -qt-libtiff -qt-libjpeg -nomake demos -nomake examples -fontconfig -platform linux-g++-32 -silent

and the 64bit as follows:

./configure -prefix /usr/local/Trolltech/Qt-4.7.2-64/ -opensource -fast -qt-sql-sqlite -qt-sql-mysql -no-qt3support -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-libpng -qt-libtiff -qt-libjpeg -nomake demos -nomake examples -fontconfig -platform linux-g++-64 -silent

The 32bit Qt works as expected and builds everything with -m32 option and links against /usr/lib so 32bit applications build flawlessly.

However, when using the 64bit qmake, it builds with -m64 as expected, but the linker path is not added -L/usr/lib64 and hence, when it tries to link pthread, this fails because libpthread.a in /usr/lib is of 32bit architecture. Only when I manually add -L/usr/lib64 to the Makefile, the build suceeds.

I sense an error in the makespecs.

Q1: How do I fix this in this installation? Edit mkspecs/linux-g++-64/ manually?
Q2: Why did this happen in the first place? Did I configure something wrong?

Philipp

wysota
19th April 2011, 14:14
I sense an error in the makespecs.
No, the specs is fine. The problem is with your compiler.


Q1: How do I fix this in this installation? Edit mkspecs/linux-g++-64/ manually?
Teach your compiler that when it builds in 64bit mode it should look for libraries in /usr/lib64


Q2: Why did this happen in the first place? Did I configure something wrong?
/usr/lib is the default place for searching for libraries so it is not added by QMake to the Makefile (you can grep the mkspecs directory to verify that). What makes this path default is the settings of your compiler - on another installation the default might be /usr/i-like-my-system-very-much or something similar. Apparently your system's 64bit environment is somehow misconfigured so it's better to fix it there. Of course editing the specs file manually might also fix the issue but then it wouldn't remove /usr/lib from the search path so you might end up with a mix of 64 and 32 bit libraries which is not what you want.