qmake configured correctly for multiarch library directories?

Josh Stratton strattonbrazil at gmail.com
Wed May 16 06:33:50 UTC 2012


I recently upgraded to 12.04 and now see two library directories on my
system, /usr/lib/ and /usr/lib/i386-linux-gnu.  The former is about
30% bigger than the latter.  When I switched to this new Ubuntu
version, my build started to break as qmake now links against
/usr/lib/i386-linux-gnu, so any libraries I were referencing residing
in /usr/lib are now missing.  For example, I can include -lGL and
-lpython as they are both in /usr/lib/i386-linux-gnu, but when I
include -lassimp it fails as the build only includes this new
multiarch dir -L/usr/lib/i386-linux-gnu.

$ qmake-qt4 --version
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/i386-linux-gnu

$ qmake -query
QT_INSTALL_PREFIX:/usr
QT_INSTALL_DATA:/usr/share/qt4
QT_INSTALL_DOCS:/usr/share/qt4/doc
QT_INSTALL_HEADERS:/usr/include/qt4
QT_INSTALL_LIBS:/usr/lib/i386-linux-gnu
QT_INSTALL_BINS:/usr/bin
QT_INSTALL_PLUGINS:/usr/lib/i386-linux-gnu/qt4/plugins
QT_INSTALL_IMPORTS:/usr/lib/qt4/imports
QT_INSTALL_TRANSLATIONS:/usr/share/qt4/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/usr/lib/qt4/examples
QT_INSTALL_DEMOS:/usr/lib/qt4/demos
QMAKE_MKSPECS:/usr/share/qt4/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.8.1

I know there was a bit of work to get cmake compatible with the
multiarch specification, but haven't heard much about qmake, but I was
wondering if I really had to hardcode /usr/lib into my CXX flags.  I
just want to know if this is the required configuration when using
qmake now or if there's something incorrect on my system and there's a
more elegant way to configure qmake system-wide to use both
directories...

so this...

g++  -L/usr/lib/i386-linux-gnu ...

looks like this...

g++ -L/usr/lib/i386-linux-gnu -L/usr/lib ...

I did find the following link, but it doesn't tell me much about what
happened in the transition.

http://wiki.debian.org/QtMultiarchTransition

I tried a hello-world example in cmake and saw the following output,
which seems to include both directories correctly.

CMakeCXXCompiler.cmake:SET(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES
"/usr/lib/gcc/i686-linux-gnu/4.6;/usr/lib/i386-linux-gnu;/usr/lib;/lib/i386-linux-gnu;/lib")

However, in my hello-world example of qmake and my current project, I
get the following:

g++ -Wl,-O1 -o foo     -L/usr/lib/i386-linux-gnu -lQtGui -lQtCore -lpthread

Like I said, the majority of my libraries are still in /usr/lib and
now qmake doesn't link against them by default.  Is this a bug?  Is
this just an accepted consequence of multiarch?  Or is there something
I need to configure that wasn't handled properly in my upgrade?



More information about the ubuntu-devel mailing list