Lieuwe
Lieuwe

Reputation: 1840

Compiling 32-bit Qt applications on a 64-bit Linux OS

I know something similar to this question has been asked here before, but my situation is slightly different.

I have a 64-bit OS. I have both the i686 and the x86_64 qt development packages installed. I would like to compile a 32-bit binary. I have added

QMAKE_CXXFLAGS += -m32

to the .pro file. However (using qmake from the i686 package) the Makefile that is generated still uses 64-bit references, i.e.

CFLAGS   = -m32 [...] -m64 [...]
INCPATH  = -I/usr/lib64/qt-3.3/mkspecs/default
Makefile: MyApp.pro  /usr/lib64/qt-3.3/mkspecs/default/qmake.conf /usr/lib64/qt-3.3/lib/libqt-mt.prl

What am I doing wrong? (Oracle Linux 6.9, Qt 3.3, gcc 4.4.7)

Upvotes: 4

Views: 3975

Answers (1)

Lieuwe
Lieuwe

Reputation: 1840

I stumbled upon the answer after a long time. I had to change a set of environment variables from

QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib

to

QTDIR=/usr/lib/qt-3.3
QTINC=/usr/lib/qt-3.3/include
QTLIB=/usr/lib/qt-3.3/lib

And (because I am using the x86_64 gcc package) add the following to my .pro file

QMAKE_LFLAGS += -m32
QMAKE_CXXFLAGS += -m32

Upvotes: 4

Related Questions