Building a 32bit application on a 64bit machine.



  • I'm getting close.

    I'm using mkspec linux-g++-32, and the CFLAGS, CXXFLAGS and LFLAGS all have -m32 in them and all of the object files are compiled into 32 bit.

    But the linker is still using -L/usr/lib/x86_64-linux-gnu and not -L/usr/lib/i386-linux-gnu and I can not seem to find out how to fix it. Here is a copy of the linker line:

    *g++ -m32 -o Test2 main.o -L/usr/lib/x86_64-linux-gnu -L/usr/share/jps-audioproc-third-party/boost/lib -lboost_program_options -lboost_system -lboost_thread -L/usr/lib/i386-linux-gnu -lQtCore -lpthread *

    I have tried to remove the x86_64 directory by: LIBS -= -L/usr/lib/x86_64-linux-gnu but that did not work.

    I tried changing the Projects->Build Settings->Build Environment->LD_LIBRARY_PATH to /usr/lib/i386-linux-gnu. But that did not help.

    The error I get is a sequence of errors in the link process like this one:

    /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread

    and here is a copy of my .pro file.

    *#-------------------------------------------------

    Project created by QtCreator 2014-10-14T11:06:28

    #-------------------------------------------------

    QT += core

    QT -= gui

    QMAKESPEC=linux-g++-32

    QMAKE_CXXFLAGS += -std=c++0x
    QMAKE_CXXFLAGS += -O0

    INCLUDEPATH += /usr/share/jps-audioproc-third-party/boost/include
    LIBS += -L/usr/share/jps-audioproc-third-party/boost/lib -lboost_program_options -lboost_system -lboost_thread
    LIBS += -L/usr/lib/i386-linux-gnu -lpthread
    LIBS -= -L/usr/lib/x86_64-linux-gnu

    TARGET = Test2
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp*



  • Hi,

    I got around the problem by installing a 32-bit virtual machine on my 64-bit machine. If you find a better way, I'm very interested :).



  • If I go into the make file and change:
    -L/usr/lib/x86_64-linux-gnu
    to
    -L/usr/lib/i386-linux-gnu
    in the LIBS line it all works!!

    Of course next time qmake runs it is reverted.

    But, I can't find out where qmake gets that variable.



  • This can't be the right way to fix this, but....
    In Projects->Build Settings->Build Steps between the qmake and make steps I added a new step that does this:

    sed -i 's|-L/usr/lib/x86_64-linux-gnu|-L/usr/lib/i386-linux-gnu|' Makefile

    to change the location of the libraries. And it works now.

    come-on-people...there must be a correct way.



  • May I ask how you got 32bit Qt libraries on your 64bit machine. And have you checke the makespec system?



  • I installed the 32 bit libraries in Ubuntu by running this:
    @sudo apt-get install ia32-libs@

    And yes I changed the makespec to 32 bit by putting this line in the *.pro file:
    @QMAKESPEC=linux-g++-32@

    But I also changed Projects->Build Settings->Build Steps->qmake->Additional arguments to:
    @ -spec linux-g++-32@


Log in to reply
 

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