CENTOS下安装 QT

五一劳动节后双休日期间,装QT,花了二天时间,刚安装完....记录下酸甜苦辣....我的系统是 CenttOS5.5
      具体的安装办法:
      1、前往
ftp://ftp.qt.nokia.com/qt/source下载Qt 4.5.3 for X11 OpenSource 版。


      2、下载过来的是 qt-x11-opensource-src-4.5.3.tar.gz文件,我们用tar命令解压一下。

      tar zxvf qt-x11-opensource-src-4.5.3.tar.gz

      3、把这个目录移到/usr/local目录下,或者不移,放在/home或其它目录都可以。下面的安装过程是把这个目录移到/usr/local目录下,改名为qt ;如果您没有移动,在设置的时候注意目录。


      4、修改(可以使用
vi编辑器 或gedit)自己目录下的.bash_profile 或者 .profile或者是/etc/profile这个文件,如:#vi /root/.bash_profile 或#vi .bash_profile 或#vi /etc/profile 或 #vi .profile

加入下面的代码:

QTDIR=/usr/local/qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH

       5、注销一下用户或者 #source /root/.bash_profile 一下,使配置文件生效。如果第4步是#vi .bash_profile,则应该是:# source .bash_profile     ,其它情况依此类推。

       6、进入QT 的目录,开始编译

                  ./configure

      输入yes同意GPL/QPL协议。
      在网络上还看到这个命令 ./configure -thread,为了支持多线程,大家还是敲一下这些命令好了。./configure -thread 和 ./configure 命令,我都试过了,没有重复,./configure -thread运行时间比./configure要短得多。

运行完./configure有如下提示:

Qt is now configured for building. Just run 'gmake'.
Once everything is built, you must run 'gmake install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.5.3

To reconfigure, run 'gmake confclean' and 'configure'.

       7、开始make  ,这步要很长时间,我花了从中午12点开始直到第二天凌晨5点我醒来时还没运行完。

                                make
根据第6运行完命令./configure后的提示,我们或者可以输入以下命令,即:

                                gmake(我使用此命令)

      8、开始install  (网上的一些手册没有这步,会出现 error while loading shared libraries: libQTDesignerComponents.so4 错误,我make install一下之后,就OK了。 )这步也要挺久的,我的机器花了大概一个多小时。

                            make install

根据第6运行完命令./configure后的提示,我们或者可以输入以下命令,即:
                            gmake install(我使用此命令)

      9、进入QT的目录,进入bin目录,然后运行 ./designer,大家可以看到图形界面了吧。


 

原文地址:https://www.cnblogs.com/javawebsoa/p/3059961.html