How to create a 32-bit application on 64-bit machine
Ubuntu 11.10 (and onwards) supports 32-bit as well as 64-bit apps i.e. 32 & 64 bit libraries are present. I tried my my best by making changes in "makefile" replacing 64-bit lib paths with i386 paths but all in vain. I have both 32 as well as 64 bit qt libs installed but only 64 bit compilation occurs. 32 bit apps run nicely on my 64-bit computer, but i can't compile 32 bit apps.
Dimitri by Google said:
@I suggest you create your own mkspecs/linux-g++-32 directory, it's just
a matter of adding "-m32" to QMAKE_CFLAGS, QMAKE_CXXFLAGS, QMAKE_LFLAGS.@
and did u seen this: http://www.cyberciti.biz/tips/compile-32bit-application-using-gcc-64-bit-linux.html
@mkspecs/linux-g++-32 directory is already present@
After making all the necessary changes: i get following error:
@/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libQtGui.so when searching for -lQtGui
/usr/bin/ld: cannot find -lQtGui
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libQtCore.so when searching for -lQtCore
/usr/bin/ld: cannot find -lQtCore
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.a when searching for -lpthread
collect2: ld returned 1 exit status
make: *** [netbridge] Error 1
The makefile automatically gets changed with every i386 replaced with x86-64
@/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libQtGui.so when searching for -lQtGui@
I think this is the right issue, while if you set 32bit libraries as default these ARE incompatible.
Question is if make finds the right ones, and if nor than why. Are all paths set properly?
The address for lib in makefile is:
But it still looks in
The above error occurs because of using -m32. The makefile automatically gets changed with every i386 replaced with x86-64 after typing make in terminal.
So what to do.
and variable $LIBRARY_PATH directs to where?
I am sorry, I am not so much familiar with linux programming, so I can't help you any more.
After that I have no linux instalation on my computers since years, and so many has changed...
I think u should set LIBRARY_PATH and export it somehow to QT_LIBDIRS. The same with includes.
I also have experienced that some tools caches data,so to see changes it is sometimes usefull to delete data and build directories in (epoc32 in my case) QtSDK
How about setting up a 32bit system in a chroot using debootstrap and then building the 32binaries in there? That gets you round the trouble of making sure that the compiler does not accidentally pick up the wrong thing.
I basically have one chroot per project (and target environment) set up. That gets me around cross-compiling and has the nice side effect that I notice whenever somebody introduces a new dependency (which is not installed in my minimalistic chroots;-). schroot is a nice tool to manage the zoo of chroots and switch between those by the way.
I have never used chroot before, but it seems it is worth giving a try. Thanks!