Statically compiling QT under Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.