Compile Qt5.7 Apps on CentOS 7 for Distribution on CentOS 5



  • Is it possible to compile a Qt app on a CentOS 7 machine that will run on a CentOS 5 machine? Preferably we would be using a commercial license to statically link the application and avoid the necessity of distributing dynamic libraries. I have compiled a hello world application outside of Qt Creator in 7 and ran it fine on 5 (proving the concept is viable) but I have not been able to do the same within Qt. At this point, I am stuck since I have only produced dynamically linked executables that require libraries that are not present on the CentOS 5 machine. Simply copying into place the libraries from CentOS 7 fail, seemingly due to binary incompatibility. Thus, my current attempt is to compile 5.7 with static libraries on CentOS7 in hope that can build something that will run in 5. I feel like there would need to be some compile arguments (ABI???) that would need to be present both when compiling Qt as well as compiling a Qt application in Qt Creator? Any insight on this would be quite appreciated.



  • Simple answer is no. Qt version 5.x cannot be compiled on CentOS5 as is; some people have managed to get a subset of it to compile but this means building various things like xcb libraries. Qt has an aggressive obsolescence policy towards older OS's.

    Your best bet would be to compile Qt 4.8.7 on a CentOS5 VM and build your app using that.



  • @jasonevident said in Compile Qt5.7 Apps on CentOS 7 for Distribution on CentOS 5:

    Is it possible to compile a Qt app on a CentOS 7 machine that will run on a CentOS 5 machine?

    For any project with more-than-trivial dependencies (and the Qt framework is certainly not trivial ;) ) then you'd want to be be looking at Fedora's mock.

    Mock is a tool for building packages. It can build packages for different architectures and different Fedora, RHEL, and Mageia versions than the build host has.

    So, using CentOS 7, mock can build packages for CentOS 5, for example, that link to / depend only on packages provided by CentOS 5.

    Note, although mock is a tool for "building packages" (ie RPMs), it provides the complete build-chain for the target (Fedora/RHEL/CentOS-based) system(s), so you can build just binaries if you want, but I'd recommend you go all the way to RPMs anyway.

    Cheers.


Log in to reply
 

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