1. 安装必需的环境
安装gcc和g++:
[root@lhj]# yum install gcc
[root@lhj]# yum install gcc-c++安装Xlib:
[root@lhj]# yum install libX11-devel libXext-devel libXtst-devel2. 下载 qt
官网下载地址:http://qt-project.org/downloads。
CentOS安装选择
- Qt libraries 4.8.6 for Linux/X11 (230 MB) (Info) 3. 将下载的qt进行解压
# tar zxvf qt-everywhere-opensource-src-4.8.6.tar.gz
4. 进行配置 - 在解压文件下新建一个可执行文件qt.conf(交叉编译的配置见最后build_qt.sh)
#! /bin/sh
./configure -prefix /usr/local/qt-4.8.6 -release \
-fast -nomake demos -nomake docs -nomake \
examples -silentchmod +x qt.conf
./qt.conf
输入O和yes
我选择安装在/usr/local/qt-4.8.6下,最后配置环境的时候要记得更换成自己安装的目录。
-
5. 编译、运行
这步可能会花费比较长的时间,需要耐心等大
# make
# make install
6. 安装成功,配置环境变量将安装路径写到环境变量中
# vim /etc/profile
加入以下内容: export QTEDIR=/usr/local/qt-4.8.6:$QTEDIR
export PATH=/usr/local/qt-4.8.6/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/qt-4.8.6/lib:$LD_LIBRARY_PATH- #source /etc/profile
交叉编译qt-4.8.6的配置
build_qt.sh
-
#!bin/bash
./configure -prefix /soft/qt-4.8.6-arm \
-opensource \
-confirm-license \
-embedded arm \
-xplatform qws/linux-arm-g++ \
-platform /qws/linux-x86-g++ \
-little-endian \
-host-little-endian \
-shared \
-no-qt3support \
-no-phonon -no-phonon-backend \
-qt-zlib \
-no-gif \
-no-libtiff \
-no-qvfb \
-qt-libjpeg \
-no-nis \
-no-opengl \
-no-cups \
-no-webkit \
-no-glib \
-no-dbus \
-no-rpath \
-no-mmx -no-3dnow \
-no-sse -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \
-no-avx -no-neon \
-no-audio-backend \
-no-svg \
-no-javascript-jit \
-no-script \
-no-scripttools \
-no-multimedia \
-no-openssl \
-nomake tools \
-qt-mouse-tslib \
-I/soft/tslib/include \
-L/soft/tslib/lib