安装与建立qt桌面运行环境

安装与建立qt桌面运行环境

安装与建立qt桌面运行环境

1、  准备工具

操作系统:REDHAT LINUX 9.0

Qt工具包:      tmake-1.13.tar.gz   qt-embedded- 2.3.10 -free.tar.gz     qt-x11-2.3.2.tar.gz

2、  安装步骤

把上述3个压缩包某个目录下,我的是存放在/arm2410s/gui/Qt/src目录下。因为redhatlinux9.0gcc版本是2.95.2,所以要安装编译器arm-linux-gcc- 3.4.1 。这个需要自己下载一个了。我的gcc压缩包放在/arm2410s/gui/Qt/rools/目录下。下面为安装步骤:

cd /arm2410s/gui/Qt/tools

tar xjvf arm-linux-gcc- 3.4.1 .tar.bz2 –C ./

然后修改/root/.bash_profile文件中的PATH环境变量

vi /root/.bash_profile

将文件中的PATH变量改为

PATH=$PATH:$HOME/bin:arm2410s/gui/Qt/tools/usr/local/arm/ 3.4.1 /bin/

然后运行如下命令:

Source /root/.bash_profile

接下来就把下面的代码保存为一个名为qt.sh的脚本,把里面的中文说明去掉,和上述三个源代码包放在同一个目录下。

#!/bin/sh

make()

{

       command make "$@"

}

 

dbgmake()

{

       command make "$@" > "$BUILD_LOG"

}

echo "set the env vary"

#注意下面pwd左右的两撇是在键盘上数字1键左边的那个键上的撇号。这里是设置环境变量

export TMAKEDIR=`pwd`/tmake-1.13

export QTEDIR=`pwd`/qt- 2.3.10

export QT2DIR=`pwd`/qt- 2.3.2

 

echo "display env"

echo $TMAKEDIR

echo $QTEDIR

echo $QT2DIR

解压三个压缩包

echo "unpack"

if [ ! -d $TMAKEDIR ]; then

       tar xzvf tmake-1.13.tar.gz

fi

if [ ! -d $QTEDIR ]; then

       tar xzvf qt-embedded- 2.3.10 -free.tar.gz

fi

if [ ! -d $QT2DIR ]; then

       tar xzvf qt-x11- 2.3.2 .tar.gz

fi

下面是测试看看上述解压工作是否成功

echo "check if qtedir exists"

if test -z "$QTEDIR"; then

       echo "PROBLEM:"

       echo "QTEDIR is not set."

       echo "Please set QTEDIR to the location where the Qt-Embedded sources are installed."

       exit

fi

if ! test -d "$QTEDIR"; then

       echo "PROBLEM:"

       echo "QTEDIR doesn't exist"

       echo "Please set QTEDIR to the location where the Qt-Embedded sources are installed."

       exit

fi

if ! test -f "$QTEDIR/src/kernel/qapplication.cpp"; then

       echo "PROBLEM:"

       echo "QTEDIR exist,but it doesn't seem to contain the required files."

       echo "QTEDIR is set to : $QTEDIR"

       echo "Please check QTEDIR to verify that it points to the location where the Qt-Embedded sources are installed."

       exit

fi

echo "QTEDIR : OK"

 

echo "check if qt2dir exists"

if test -z "$QT2DIR"; then

       echo "PROBLEM:"

       echo "QT2DIR is not set."

       echo "Please set QT2DIR to the location where the Qt-x11- 2.3.2 sources are installed."

       exit

fi

if ! test -d "$QT2DIR"; then

       echo "PROBLEM:"

       echo "QT2DIR doesn't exist"

       echo "Please set QT2DIR to the location where the Qt-x11- 2.3.2 sources are installed."

       exit

fi

if ( ! test -f "$QT2DIR/src/kernel/qapplication.cpp" || test -d "$QT2DIR/qmake") && ! test -f "$QT2DIR/bin/uic"; then

       echo "PROBLEM:"

       echo "QT2DIR exist,but it doesn't seem to contain the required files."

       echo "QT2DIR is set to : $QT2DIR"

       echo "Please check QT2DIR to verify that it points to the location where the Qt-x11- 2.3.2 sources are installed."

       exit

fi

echo "QT2DIR : OK"

 

echo "check if qtedir exists"

if test -z "$TMAKEDIR"; then

       echo "PROBLEM:"

       echo "TMAKEDIR is not set."

       echo "Please set QTEDIR to the location where the Qt-Embedded sources are installed."

       exit

fi

if ! test -d "$TMAKEDIR"; then

       echo "PROBLEM:"

       echo "QTEDIR doesn't exist"

       echo "Please set QTEDIR to the location where the Qt-Embedded sources are installed."

       exit

fi

if ! test -f "$TMAKEDIR/bin/tmake" || ! test -d "$TMAKEDIR/lib/linux-g++"; then

       echo "PROBLEM:"

       echo "QTEDIR exist,but it doesn't seem to contain the required files."

       echo "QTEDIR is set to : $QTEDIR"

       echo "Please check QTEDIR to verify that it points to the location where the Qt-Embedded sources are installed."

       exit

fi

echo "TMAKEDIR : OK"

 

export TMAKEPATH="$TMAKDIR/lib/linux-g++"

编译qtx11

echo "build qtx11 if needed"

export QTDIR="$QT2DIR"

cd "$QTDIR"

export PATH="$QTDIR/bin:$PATH"

export LD_LIBRARY_PATH="$QTDIR/lib:$LD_LIBRARY_PATH"

if ! test -f "$QT2DIR/bin/uic"; then

       echo "***********************************"

       echo "******** build qt-x11- 2.3.2 ********"

       echo "***********************************"

       echo yes | ./configure -no-xft

       make

else

       echo "***********************************"

       echo "******Qt-x11- 2.3.2 a lready built***"

       echo "***********************************"

fi

       cp -arf "$QTDIR/bin/uic" "$QTEDIR/bin/"

       echo "***********************************"

       echo "******** build qvfb****************"

       echo "***********************************"

export TMAKEPATH="$TMAKDIR/lib/linux-g++"

export QTDIR="$QT2DIR"

export PATH="$QTDIR/bin:$PATH"

export LD_LIBRARY_PATH="$QTDIR/lib:$LD_LIBRARY_PATH"

cd "$QTEDIR"

cd tools/qvfb

tmake qvfb.pro > Makefile

make

mv qvfb "$QTEDIR/bin"

编译qtembedded

cd "$QTEDIR"

export TMAKEPATH="$TMAKDIR/lib/qws/linux-x86-g++"

export QTDIR="$QTEDIR"

export PATH="$QTDIR/bin:$PATH"

export LD_LIBRARY_PATH="$QTDIR/lib:$LD_LIBRARY_PATH"

 

if ! test -f "$QTEDIR/lib/libqte-mt.so" -o -f "$QTEDIR/lib/libqte.so" ; then

       echo "***********************************"

       echo "******** build qt/embedded*********"

       echo "***********************************"

       echo yes | ./configure -no-xft -qvfb -depths 4,8,16,32

       make

else

       echo "***********************************"

       echo "******Qt/embedded already built****"

       echo "***********************************"

fi

cd ..

 

运行如下命令:

source qt.sh

大功告成,在中途有提示输入只要输入yes即可。

你可能感兴趣的:(安装与建立qt桌面运行环境)