I use Ubuntu 10.04 and Qt4.6, and I created an executable binary on my own computer through QtCreator.
Now I want to put my executable on CentOS 5, but it seems that this executable cannot work on CentOS.
Error message
bash: ./[filename]: cannot execute binary file
Now I know that this comes from a 32-bit and 64-bit problem and successfully creates a 32-bit exexutable file.
However, this executable still cannot work on CentOS due to a dynamic link problem, it always shows that:
Error while loading shared libraries: libQtGUI.so.4: cannot open shared object file: No such file or directory
I tried adding the "-static" flag to the .pro file
QMAKE_CFLAGS_RELEASE += -Os -static QMAKE_CPPFLAGS_RELEASE += -Os -static QMAKE_CXXFLAGS_RELEASE += -Os -static QMAKE_CCFLAGS_RELEASE += -Os -static
however, it looks like it only generates “static binary”, but not “static”, the dependency still exists.
I also tried adding the following line to the .pro file:
QMAKE_LFLAGS += static
But this project cannot compile after that. I do not have permission to install Qt on Cent OS, how can I compile this project with static link so that the executable can work independently?
Thank you for your help!
c ++ cross-platform qt qt4 qt-creator
Claire huang
source share