QT installed in a compile-time configuration, the default compilation is dynamically compiled, but sometimes you write a program to publish, with a lot of dynamic library files is very cumbersome, it is necessary to statically compile your program, QT to achieve static compilation must be a library file is also statically compiled, So here's a look at how QT can be statically compiled.
First step: Download the source package
Qt/x11 version: qt-x11-opensource-src-x.x.x.tar.gz
Step Two: Unzip
Tar zxvf qt-x11-opensource-src-x.x.x.tar.gz
Step three: Go to the folder you just unzipped and configure it as follows
./configure-release-platform Linux-g++-64-static-nomake Examples-nomake Demos-no-qt3support-no-script-no-scriptto Ols-no-multimedia-no-audio-backend-no-openssl-no-opengl-no-webkit-no-phonon-no-sql-sqlite
Fourth step: After the previous step is successfully configured, you can compile the
Make or Gmake
Fifth Step: Install
Make install or gmake install
Sixth step: Configure Environment variables:
#vi/root/.bash_profile//Open root user. bash_profile file
Set the environment variable in the root user. bash_profile file, and add the following in this file:
QTDIR=/USR/LOCAL/TROLLTECH/QT-X.X.X{QT Actual installation path}
Path= $QTDIR/bin: $PATH
Manpath= $QTDIR/doc/man: $MANPATH
Ld_library_path= $QTDIR/lib: $LD _library_path
Export Qtdir PATH Manpathld_library_path
and then save
Source/etc/profile the environment variable that was just in effect.
This will set up the QT environment.
The next step is to install the QT-SDK, just install the creator, without installing the library!!!
After the installation is complete, set the path to Qmake:
To open the Qtcreator interface:
Tools->options->qt->qmake Location:/usr/local/trolltech/qt-x.x.x/bin/qmake
Reference: http://www.linuxidc.com/Linux/2011-05/35581.htm
Statically compiling QT under Linux