I'm using Ubuntu 10.04 and Qt4.6, and I've created an executable binary file on my own computer through QtCreator.
Now I want to put my executable file on CentOS 5, but it seems that this executable file cannot run on CentOS.
The error message is
bash: ./[filename]: cannot execute binary file
Now I know this comes from 32-bits and 64-bits problem, and successfully create 32-bit exexutable file.
However, this executable file still cannot run on CentOS because of the dynamic linkage 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 to add the "-static" flag on .pro file
QMAKE_CFLAGS_RELEASE += -Os -static
QMAKE_CPPFLAGS_RELEASE += -Os -static
QMAKE_CXXFLAGS_RELEASE += -Os -static
QMAKE_CCFLAGS_RELEASE += -Os -static
however, looks like that it only generate "static binary" but not "static linked", the dependency still exists.
I also tried to add following line on .pro file:
QMAKE_LFLAGS += static
But this project cannot compile after doing this. I don't have permission to install Qt on Cent OS, how can I compile this project with static linkage so that the executable file can run independently?
Thanks for your help!