How to compile for Linux 32-bit on a Linux 64-bit platform?

  • Dear all,

    I am having hard times trying to figure out how to configure the build system to get a 32-bit executable while developing on a 64-bit Linux station.

    I have done the following:

    • install all 32-bit libraries
    • add "-spec linux-g++-32" to qmake additional arguments
    • choose the 32-bit C and C++ compilers

    However in the Makefile generated by qmake I still see a lot of "/usr/lib64" paths used for the libraries instead of the expected "/usr/lib". I can see the "-m32" option used for g++ though.

    Anyone knows what is missing to get the correct result?


  • Moderators

    @pims Did you install 32bit Qt?

  • Yes I installed all 32 and 64 bits packages.

    I am actually trying to understand what are the options in the project file or in qmake that make the correct library path to be used.

  • Here is what I can see in the Makefile:


    Command: /usr/bin/qmake-qt5 -spec linux-g++-32 -o Makefile ../src/

    LIBS = $(SUBLIBS) -L/usr/lib/qt5/plugins/sqldrivers -lqsqlmysql -L/usr/lib/mysql -lmysqlclient -L/usr/lib64 -lQt5Charts -lQt5Widgets -lQt5Gui -lQt5Sql -lQt5Xml -lQt5Core -lGL -lpthread

    I am expecting to see -L/usr/lib instead of -L/usr/lib64

  • OK, I found the culprit: I was using the correct compiler but the wrong Qt version in the kits definition.


Log in to reply