QT Linux下安装手册

      QT的安装办法有很多,百度一下有一大堆,但是大部分的手册都是复制粘贴的,并不能使用。
      具体的安装办法:
      1、去这里下载Qt 4.4.0 for X11 OpenSource版。
      2、下载过来的是 qt-x11-opensource-src-4.4.0.tar.gz 文件,我们用tar命令解压一下。
      tar zxvf qt-x11-opensource-src-4.4.0.tar.gz
      3、把这个目录移到/usr/local目录下,或者不移,放在/home目录也无所谓,下面的安装过程是把这个目录移到/usr/local目录下,改名为qt,如果您没有移动,在设置的时候注意目录。
      4、修改(可以使用vi编辑器或者gedit)自己目录下的.bash_profile 或者 .profile或者是/etc/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 .bash_profile 一下,使配置文件生效。
      6、进入QT的目录,开始编译
      ./configure
      输入yes同意GPL/QPL协议。
      在网络上还看到这个命令 ./configure -thread,为了支持多线程,大家还是敲一下这些命令好了。(不知道./configure -thread 和 ./configure 命令有没有重复)
      7、开始make 这步要一两个小时
      make
      8、开始install  (网上的一些手册没有这步,会出现 error while loading shared libraries: libQTDesignerComponents.so4 错误,我make install一下之后,就OK了。)这步也要挺久的,大概几十分钟吧。
      make install
      9、进入QT的目录,进入bin目录,然后运行 ./designer,大家可以看到图形界面了吧。

3 Comments

  1. # bash
    bash-3.00# cd /usr/local/qt/
    bash-3.00# ./configure

    This is the Qt/X11 Open Source Edition.

    /usr/local/qt/config.tests/unix/fvisibility.test: CC: 没找到
    You are licensed to use this software under the terms of either
    the Q Public License (QPL) or the GNU General Public License (GPL)
    versions 2 or 3

    Type 'Q' to view the Q Public License.
    Type '2' to view the GNU General Public License version 2.
    Type '3' to view the GNU General Public License version 3.
    Type 'yes' to accept this license offer.
    Type 'no' to decline this license offer.

    Do you accept the terms of either license? yes

    Creating qmake. Please wait...
    CC -c -o project.o -DQMAKE_OPENSOURCE_EDITION -I. -Igenerators -Igenerators/uni x -Igenerators/win32 -Igenerators/mac -I/usr/local/qt/include -I/usr/local/qt/in clude/QtCore -I/usr/local/qt/include -I/usr/local/qt/include/QtCore -I/usr/local /qt/src/corelib/global -I/usr/local/qt/src/script -DQT_NO_PCRE -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_BUILD_QMAKE -DQT_NO_CO MPRESS -I/usr/local/qt/mkspecs/solaris-cc -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT _NO_QOBJECT -DQT_NO_GEOM_VARIANT project.cpp
    gmake: CC: Command not found
    gmake: *** [project.o] Error 127
    bash-3.00# make
    make: Fatal error: No arguments to build
    bash-3.00# make install
    make: Fatal error: Don't know how to make target `install'
    bash-3.00#

    这样的问题怎么解决呀?