Important: Please read the Qt Code of Conduct -

[Cross compilation] Build a 32 app on a 64 bits computer using either CMake or QMake

  • Hi,

    I'd like to know if it is possible to compile my application for a 32 bits computer (on Linux) on a 64 bits (also on Linux).

    I would prefer to use CMake, in order to follow my enterprise development rules, but if not possible, I'll move on QMake.

    Thanks to all of you.

  • Hi,
    this will depend on your compiler you are using. If it is a pure 32bit compiler, there is probably nothing to do. If you have a 64 bit compiler you will have to find the proper compiler option to cross compile.

    You have to setup Qt as for cross compilation to any arbitrary 32 bit platform.

  • Thanks a lot. I'll try tomorrow.
    But I guess your solution is only available using QMake.
    Have you ever heard about the use of CMake ?

    For the moment, I manage to set the CXXFLAGS to m32 (to force the 32 bits compilation), but I didn't found how to link with the lib32 Qt libraries. Excuse the fact my post perhaps would be better on the forum of CMake website ;)

    Thanks !

  • It's a matter of the compiler tool chain(s) involved. If you use qmake, cmake or some hand crafted Makefiles should not matter.

  • Hi once again !

    I have an ultimate question. As I said it above, I managed to set the Cxx flag when compiling object files. But I don't know how to pass the correct flags when creating the executable.

    Thank you a lot !

  • That should be passed to the linker, using the linker flags. In regular Makefiles it's usually LDFLAGS

Log in to reply