主機版本:ubuntu11.04linux
編譯器版本:gcc 4.5.2ubuntu
準備工做,下載源碼包ui
http://qt.nokia.com/downloads/downloads#qt-creatorspa
這裏有幾個不一樣的版本,咱們下載的是 Qt libraries 4.8.2 for Linux/X11,也就是QT/X11。視頻
一、創建工做目錄 圖片
root@rjm-home:~#mkdir work ip
root@rjm-home:~# ls 文檔
work 公共的 模板 視頻 圖片 文檔 下載 音樂 桌面 get
root@rjm-home:~# cd work/ 編譯器
root@rjm-home:~/work# mkdir Qt
root@rjm-home:~/work# ls
Qt
一、創建工做目錄 root@rjm-home:~#mkdir work root@rjm-home:~# ls work 公共的 模板 視頻 圖片 文檔 下載 音樂 桌面 root@rjm-home:~# cd work/ root@rjm-home:~/work# mkdir Qt root@rjm-home:~/work# ls Qt二、把下載好的源文件(我這裏包括了Creator),複製到工做目錄
root@rjm-home:~/work#cd Qt
root@rjm-home:~/work/Qt# ls
qt-creator-linux-x86-opensource-2.5.0.bin
qt-everywhere-opensource-src-4.8.2.tar.gz
二、把下載好的源文件(我這裏包括了Creator),複製到工做目錄 root@rjm-home:~/work#cd Qt root@rjm-home:~/work/Qt# ls qt-creator-linux-x86-opensource-2.5.0.bin qt-everywhere-opensource-src-4.8.2.tar.gz三、解壓,由於是tar.gz格式的,因此先有gunzip解壓成tar格式的文件,再用tar解壓
root@rjm-home:~/work/Qt# gunzip qt-everywhere-opensource-src-4.8.2.tar.gz
root@rjm-home:~/work/Qt# ls
qt-creator-linux-x86-opensource-2.5.0.bin
qt-everywhere-opensource-src-4.8.2.tar
root@rjm-home:~/work/Qt#tar xvf qt-everywhere-opensource-src-4.8.2.tar.gz
解壓完成後
root@rjm-home:~/work/Qt# ls
qt-creator-linux-x86-opensource-2.5.0.bin
qt-everywhere-opensource-src-4.8.2
qt-everywhere-opensource-src-4.8.2.tar
三、解壓,由於是tar.gz格式的,因此先有gunzip解壓成tar格式的文件,再用tar解壓 root@rjm-home:~/work/Qt# gunzip qt-everywhere-opensource-src-4.8.2.tar.gz root@rjm-home:~/work/Qt# ls qt-creator-linux-x86-opensource-2.5.0.bin qt-everywhere-opensource-src-4.8.2.tar root@rjm-home:~/work/Qt#tar xvf qt-everywhere-opensource-src-4.8.2.tar.gz 解壓完成後 root@rjm-home:~/work/Qt# ls qt-creator-linux-x86-opensource-2.5.0.bin qt-everywhere-opensource-src-4.8.2 qt-everywhere-opensource-src-4.8.2.tar解壓完成後,進入源碼目錄進行配置。
四、配置
root@rjm-home:~/work/Qt/qt-everywhere-opensource-src-4.8.2#./configure -prefix /usr/local/Qt-4.8.2
(上面指定的這個目錄「/usr/local/Qt-4.8.2」,就是make install後的安裝目錄)
(通過一小會兒,配置完成,會出現如下信息)
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Qt-4.8.2
To reconfigure, run 'make confclean' and 'configure'.
四、配置 root@rjm-home:~/work/Qt/qt-everywhere-opensource-src-4.8.2#./configure -prefix /usr/local/Qt-4.8.2 (上面指定的這個目錄「/usr/local/Qt-4.8.2」,就是make install後的安裝目錄) (通過一小會兒,配置完成,會出現如下信息) Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into /usr/local/Qt-4.8.2 To reconfigure, run 'make confclean' and 'configure'.root@rjm-home:~/work/Qt/qt-everywhere-opensource-src-4.8.2#make
(通過N久)
root@rjm-home:~/work/Qt/qt-everywhere-opensource-src-4.8.2#make install
(通過make install qt已經被安裝在了/usr/local/Qt-4.8.2/這個文件夾中)
五、編譯 root@rjm-home:~/work/Qt/qt-everywhere-opensource-src-4.8.2#make (通過N久) root@rjm-home:~/work/Qt/qt-everywhere-opensource-src-4.8.2#make install (通過make install qt已經被安裝在了/usr/local/Qt-4.8.2/這個文件夾中)
六、設置環境變量
能夠在home/用戶/.profile中增長 (用戶就是你當前登陸的用戶)
QTDIR=/usr/local/Qt-4.8.2
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
六、設置環境變量 能夠在home/用戶/.profile中增長 (用戶就是你當前登陸的用戶) QTDIR=/usr/local/Qt-4.8.2 PATH=$QTDIR/bin:$PATH MANPATH=$QTDIR/man:$MANPATH LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH export QTDIR PATH MANPATH LD_LIBRARY_PATH
哦了,通過上面的操做,已經編譯安裝完成,而且已經設置好了環境變量。在終端中輸入qmake,若是出現不少提示信息而不是connotfind,就說明成功了。