分类: 嵌入式
2012-04-26 17:40:04
QT 4.6.2+qwt移植
主机:RHEL6.0(2.6.32-220.2.1.el6.i686)
开发板:FL2440
编译器:arm-unknown-linux-gnueabi-gcc-4.4.6
#说明qwt是第三方qt库,里面有许多画图的实现方法
1.0编译触摸屏
tar xvjf tslib-1.0.tar.bz2
mkdir tslib
cd tslib-1.0/
./autogen.sh
./configure --prefix=/home/thinker/work/tslib --host=arm-unknown-linux-gnueabi ac_cv_func_malloc_0_nonnull=yes
make
make install-strip
vim ../tslib/etc/ts.conf ##去除module_raw input前的#号,并且要顶格
2.1 QT安装
tar xvzf ~/Downloads/qt-everywhere-opensource-src-4.6.2.tar.gz -C .
cp -rvf qt-everywhere-opensource-src-4.6.2/ qt-everywhere-opensource-src-4.6.2_arm
cp -rvf qt-everywhere-opensource-src-4.6.2/ qt-everywhere-opensource-src-4.6.2_x86
cd /usr/local/
sudo mkdir Trolltech
sudo chown thinker:thinker Trolltech/ -R
cd -
2.1.1编译QT-x11
cd qt-everywhere-opensource-src-4.6.2
./configure
make -j4
make -j4 install
2.1.2 编译qvfb
cd tools/qvfb/
make
cp -f ../../bin/qvfb /usr/local/Trolltech/QtEmbedded-4.6.2/bin/ #此步骤在完成2.2.1之后执行
2.2.1编译嵌入式x86 Qt库
cd qt-everywhere-opensource-src-4.6.2_x86
./configure -embedded x86 -qt-gfx-qvfb -qt-kbd-qvfb -qt-kbd-tty -qt-mouse-qvfb -qt-mouse-pc
make -j4
make -j4 install
2.3.1编译嵌入式arm Qt库(要修改两个错误)
修改./mkspecs/qws/linux-arm-g++/qmake.conf
将none改为unknown
(添加-lts -ljpeg -lpng -ltiff参数)
cd /work/rhel/qt-everywhere-opensource-src-4.6.2_arm/
./configure -opensource -confirm-license -release -shared -embedded arm -xplatform qws/linux-arm-g++ -depths 8,16,18,24,32 -optimized-qmake -pch -qt-sql-sqlite -qt-freetype -little-endian -host-little-endian -no-qt3support -no-libmng -no-opengl -no-mmx -no-sse -no-sse2 -no-3dnow -no-openssl -no-webkit -no-phonon -no-nis -no-cups -no-glib -no-separate-debug-info -nomake docs -qt-gfx-qvfb -no-gfx-transformed -no-gfx-multiscreen -no-gfx-vnc -qt-gfx-linuxfb -qt-kbd-tty -qt-kbd-linuxinput -qt-kbd-qvfb -qt-mouse-linuxinput -qt-mouse-qvfb -qt-mouse-tslib -reduce-relocations -I/work/rhel/tslib/include -L/work/rhel/tslib/lib
make -j5
make -j5 install
3.1 设置环境变量
3.1.1 设置qt-x11环境变量
vim setenv-x11.sh
##添加如下内容:
PATH=/usr/local/Trolltech/Qt-4.6.2/bin:$PATH
LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.6.2/lib:$LD_LIBRARY_PATH
CPLUS_INCLUDE_PATH=
##保存到/usr/local/Trolltech/Qt-4.6.2退出
3.2.1 设置qt-embedded-x86环境变量
vim setenv-x86.sh
##添加如下内容:
QTEDIR=/usr/local/Trolltech/QtEmbedded-4.6.2
PATH=/usr/local/Trolltech/QtEmbedded-4.6.2/bin:$PATH
LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.6.2/lib:$LD_LIBRARY_PATH
##保存到/usr/local/Trolltech/QtEmbedded-4.6.2 退出
3.3.1 设置qt-embedded-arm环境变量
vim setenv-arm.sh
##添加如下内容:
QTEDIR=/usr/local/Trolltech/QtEmbedded-4.6.2-arm
PATH=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/bin:$PATH
LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib:$LD_LIBRARY_PATH
CPLUS_INCLUDE_PATH=/work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/include/c++:/work/rhel/gcc-4.4.6-glibc-2.9/arm-unknown-linux-gnueabi/include/c++/4.4.6:$CPLUS_INCLUDE_PATH
##保存到/usr/local/Trolltech/QtEmbedded-4.6.2-arm
退出
4.1.1 测试qvfb
/usr/local/Trolltech/QtEmbedded-4.6.2
source setenv-x86.sh
cd demos/embedded/embeddedsvgviewer/
qvfb -width 320 -height 240 &
##此后会出现一个黑色的框
./embeddedsvgviewer -qws
##黑色框里面出现svgviewer例子表明测试成功
5.1.1 安装Qdevelop for Qt4
##下载链接http://biord-software.org/downloads/qdevelop-v0.28.tar.gz
##语法指示器插件http://biord-software.org/qdevelop/plugins/astyle-plugin-rev3.zip
##从下载最新源码
##用最新的源码替换ASBeautifier.cpp ASEnhancer.cpp ASFormatter.cpp ASLocalizer.cpp ASLocalizer.h ##ASResource.cpp astyle.h astyle_main.cpp astyle_main.h文件
tar xzvf ~/Downloads/qdevelop-v0.28.tar.gz -C .
cd qdevelop-v0.28/
source /usr/local/Trolltech/Qt-4.6.2/setenv-x11.sh
lrelease Qdevelop.pro
qmake
make
sudo make install
qdevelop ##启动qdevelop
5.2.1安装QTCreator
tar zxvf ~/Downloads/qt-creator-1.3.1-src.tar.gz -C .
cd qt-creator-1.3.1-src/
source /usr/local/Trolltech/Qt-4.6.2/setenv-x11.sh
qmake
make -j4
sudo make -j4 install
qtcreator.bin #运行qtcreator
6.1qwt安装
tar xvjf ~/Downloads/qwt-6.0.1.tar.bz2
cp -rf qwt-6.0.1/ qwt-6.0.1_x86
cp -rf qwt-6.0.1/ qwt-6.0.1_arm
6.1.1编译本地qwt
cd qwt-6.0.1/
source /usr/local/Trolltech/Qt-4.6.2/setenv-x11.sh
qmake
make
cp -rf ./lib/lib* /usr/local/Trolltech/Qt-4.6.2/lib/ #拷贝qwt库到Qt
cp -rvf ./src/*.h /usr/local/Trolltech/Qt-4.6.2/include/
#拷贝qwt头文件到Qt
cp -rf ./designer/plugins/designer/libqwt_designer_plugin.so /usr/local/Trolltech/Qt-4.6.2/plugins/designer/ #拷贝qwt插件到designer
6.1.2编译嵌入式x86 qwt
#重新打开命令窗口(因为要使用嵌入式x86的qmake)
cd qwt-6.0.1_x86/
source /usr/local/Trolltech/QtEmbedded-4.6.2/setenv-x86.sh
qmake
make
cp -rf ./lib/lib* /usr/local/Trolltech/QtEmbedded-4.6.2/lib/ #拷贝qwt库到Qt-x86
cp -rvf ./src/*.h /usr/local/Trolltech/QtEmbedded-4.6.2/include/
#拷贝qwt头文件到Qt-x86
cp -rf ./designer/plugins/designer/libqwt_designer_plugin.so /usr/local/Trolltech/QtEmbedded-4.6.2/plugins/designer/ #拷贝qwt插件到designer
#用qws模拟器可测试qwt例子能否正常运行
6.1.2编译嵌入式arm qwt
#重新打开命令窗口(因为要使用嵌入式arm的qmake)
cd /work/rhel/qwt-6.0.1_arm/
source /usr/local/Trolltech/QtEmbedded-4.6.2-arm/setenv-arm.sh
#按照上两种方式编译arm的qwt,编译到qwt_designer_plugin时会出现错误,因为我们不会用到arm的qwt_designer_plugin,所以我们要修改项目文件,去除对qwt_designer_plugin的编译
#编辑qwtconfig.pri的101行,注释掉
qmake
make
cp -rvf ./lib/lib* /usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib/ #拷贝qwt库到Qt-arm
cp -rvf ./src/*.h /usr/local/Trolltech/QtEmbedded-4.6.2-arm/include/
#拷贝qwt头文件到Qt-arm
注:Qdevelop的那个语法解释器插件编译出来不可用,不能全部替换,只能修改旧版的错误
7.移植到开发板(通过nfs文件系统或者直接烧写到开发板)
##编辑/etc/profile添加qt以及tslib环境变量
export TSLIB_ROOT=/tslib
export TSLIB_TSDEVICE=/dev/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH
export QWS_DISPLAY=LinuxFb:/dev/fb0
export QWS_KEYBOARD=USB:/dev/event1
export QWS_MOUSE_PROTO=Tslib:/dev/event0
export QWS_SIZE=320x240
QTEDIR=/usr/local/Trolltech/QtEmbedded-4.6.2-arm
PATH=$QTDIR/bin:$PATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
##运行$TSLIB_ROOT/bin/ts_calibrate出现屏幕校验程序即成功移植了tslib,demos下面有许多qt的例子运行看看是否正常.