您的位置:首页 > 运维架构 > Linux

linux下安装QT的方法

2015-08-31 20:09 453 查看
1、下载qt_sdk安装???

2、命令安装(在线安装)

       

           首先在命令行输入apt-get update

           然后输入 apt-cache search qtcreator

           然后输入 apt-get install qtcreator

3、下载QT的源码自己编译。

自己下载QT源码,如: qt-soruce-4.7.4.tar

在命令行输入 tar –xzvf  qt-soruce-4.7.4.tar解压源码

然后参照http://wiki.qt.io/Building_Qt_5_from_Git这个网址的方法(见下面)

先安装QT的环境然后手动编译QT源码即可。

Qt for Linux/X11 - Building fromSource

You can download the Qt 5 sources from the Downloads page. For more information, visit the Getting
Started with Qt page.

Qt for X11 has some requirements that are given in more detailin the Qt for X11 Requirementsdocument.

Step 1:Installing the License File (Commercial Editions Only)

If you have the commercial edition of Qt, install your licensefile as 
$HOME/.qt-license
.

For the opensource version you do not need a license file.

Step 2: Unpacking the Archive

Unpack the archive if you have not done so already. For example,if you have the 
qt-everywhere-opensource-src-%VERSION%.tar.gz
 package,
type the following commands at a command line prompt:

cd /tmp

gunzip qt-everywhere-opensource-src-%VERSION%.tar.gz        # uncompress the archive

tar xvf qt-everywhere-opensource-src-%VERSION%.tar          # unpack it

This creates the directory 
/tmp/qt-everywhere-opensource-src-%VERSION%
 containing the files from the archive.
We only support the GNUversion of the tar archiving utility. Note that on some systems it is calledgtar.

Step 3: Building the Library

To configure the Qt library for your machine type, run the 
./configure
 script in the package directory.

By default, Qt is configured for installation in the 
/usr/local/Qt-%VERSION%
 directory, but this can be changed
by using the 
-prefix
 option.

cd /tmp/qt-everywhere-opensource-src-%VERSION%

./configure

The Configure Options page contains more information aboutthe configure options.

To create thelibrary and compile all the examples, tools, and tutorials, type:

make

If 
-prefix
 is outside the build directory, you need to install the library,examples, tools, and tutorials in
the appropriate place. To do this (as root ifnecessary), type:

make install

Note that onsome systems the make utility is named differently, e.g. gmake. The configurescript tells you which make utility to use.

Note: If you laterneed to reconfigure and rebuild Qt from the same location, ensure that alltraces of the previous configuration are removed
by entering the builddirectory and typing 
makeconfclean
 beforerunning 
configure
 again.

Step 4: Set the Environment Variables

In order touse Qt, some environment variables needs to be extended.

PATH               - to locate qmake, moc and other Qt tools

This is donelike this:

In 
.profile
 (if your shell is bash, ksh, zsh or sh), add the followinglines:

PATH=/usr/local/Qt-%VERSION%/bin:$PATH

export PATH

In 
.login
 (in case your shell is csh or tcsh), add the following line:

setenv PATH /usr/local/Qt-%VERSION%/bin:$PATH

If you use adifferent shell, please modify your environment variables accordingly.

For compilers that do not support rpath you must also extendedthe 
LD_LIBRARY_PATH
 environment variable to include 
/usr/local/Qt-%VERSION%/lib
.
On Linuxwith GCC this step is not needed.

qt的环境变量:

1,

export QTDIR=/home/yupont/qt453

export QTLIB=$QTDIR/lib

export QTINC=$QTDIR/include

export QMAKESPEC=$QTDIR/mkspecs/linux-g++

export MANPATH=$QTDIR/man:$MANPATH

export PATH=$QTDIR/bin:$PATH

不知道是不是都要设置

QTLIB和LD_LIBRARY_PATH有啥区别?

2,

export QTDIR=/home/d5000/qt453

export PATH=$QTDIR/bin:$PATH  

export MANPATH=$QTDIR/man:$MANPATH  

export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: