转载注明出处:袁方的技术博客 http://blog.csdn.net/yf210yf/article/details/7354215
原来虽然移植过qt,但这次用友善之臂的tiny6410移植QT4.7.3还是费了一下午时间。
现在写点什么总结下。
【目标板】tiny6410
【虚拟机】ubuntu 11.04
【编译器】arm-linux-gcc 4.3.2
【安装源】
(1) Qt_SDK_Lin32_offline_v1_1_2_en.run
http://qt.nokia.com/downloads/sdk-linux-x11-32bit-cpp-offline
(2) qt-everywhere-opensource-src-4.7.3.tar.gz
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.tar.gz
(3) tslib1.4.tar.gz
(4) arm-linux-gcc 4.3.2
前提tslib1.4已经编译安装完成,具体方法看另篇博文http://blog.csdn.net/yf210yf/article/details/7352470。
步骤:
(1)将qt-everywhere-opensource-src-4.7.3.tar.gz解压到指定目录
(2)终端cd进入qt-everywhere-opensource-src-4.7.3.tar.gz解压目录
(3)配置
# ./configure -prefix /opt/QtEmbedded-4.7.3 -release -shared -fast -pch -no-qt3support -qt-sql-sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -no-openssl -nomake examples -nomake demos -nomake tools -optimized-qmake -no-phonon -no-nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm -no-xinerama -no-xshape -no-separate-debug-info -xplatform qws/linux-arm-g++ -embedded arm -depths 16 -no-qvfb -qt-gfx-linuxfb -no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb -confirm-license -qt-mouse-tslib -I/opt/tslib/include -L/opt/tslib/lib
备注:
最后3句是指定使用触摸屏,并制定tslib1.4的安装目录的头文件以及库函数。我的tslib是安装在opt下。
(4)make
(5)make install
至此arm版的qt4.7.3安装完毕,在arm板上跑qt的支持文件为/opt/QtEmbedded-4.7.3,将整个文件夹拷贝到arm板的文件系统的相应位置下即可。
注意:
开始我用的友善自带的工具链4.5.1,用上面的配置出现错:
shared/qimage_neon.o image/qimage_neon.cpp
image/qimage_neon.cpp: In function 'void qt_convert_rgb888_to_rgb32_neon(quint32*, const uchar*, int)':
image/qimage_neon.cpp:66: error: 'uint8x8_t' does not name a type
image/qimage_neon.cpp:82: error: 'fullVector' was not declared in this scope
make[1]: *** [.obj/release-shared/qimage_neon.o] Error 1
make[1]: Leaving directory `/home/hancy/qt_src/qt-everywhere-opensource-src-4.7.4/src/gui'
make: *** [sub-gui-make_default-ordered] Error 2
hmmm, you need add arm_neon.h to your qt sorce code, and modify the image/qimage_neon.cpp add #include "yourpath/arm_neon.h" under #ifdef QT_HAVE_NEON
you can find arm_neon.h from attached.
把arm_neon.h头文件也加入,接着出现错误:
shared/qimage_neon.o image/qimage_neon.cpp
In file included from image/qimage_neon.cpp:45:
image/arm_neon.h:32:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
image/qimage_neon.cpp: In function 'void qt_convert_rgb888_to_rgb32_neon(quint32*, const uchar*, int)':
image/qimage_neon.cpp:67: error: 'uint8x8_t' does not name a type
image/qimage_neon.cpp:83: error: 'fullVector' was not declared in this scope
make[1]: *** [.obj/release-shared/qimage_neon.o] Error 1
make[1]: Leaving directory `/home/hancy/qt_src/qt-everywhere-opensource-src-4.7.4/src/gui'
make: *** [sub-gui-make_default-ordered] Error 2
又查阅资料:
for here "image/arm_neon.h:32:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
"
you should add " -mfloat-abi=softfp -mfpu=neon" to your makefile CFLAG and CXXFLAG, the makefile is under `/home/hancy/qt_src/qt-everywhere-opensource-src-4.7.4/src/gui'
再次编译,发现上面所说的makefile是自动生成的,加入了 -mfloat-abi=softfp -mfpu=neon,依然出现错误
无奈去官网查了下,发现如下文章:
Error when building Qt for ARM
Hi,
I’m trying to build qt-everywhere-commercial-src-4.7.3 (with a commercial evaluation license) on Ubuntu 11.04 for an embedded linux system (ARM11). I’ve been roughly following this guide: http://developer.qt.nokia.com/wiki/Building_Qt_for_Embedded_Linux
I’ve successfully done the host build but am now having problems with the target build.
What I have done so far:
Cross-compiled libts with arm-linux-gnueabi-gcc and modified qmake.conf for the linux-arm-gnueabi-g++ mkspec to add the paths to the include and lib directories for this libts build.
The following configure command:
./configure -xplatform qws/linux-arm-gnueabi-g++ -embedded arm \
-qt-gfx-linuxfb -qt-gfx-vnc \
-no-largefile -exceptions -no-accessibility -no-qt3support -no-sse2 -qt-zlib -no-gif -no-libtiff \
-qt-libpng -no-libmng -qt-libjpeg -no-openssl -no-nis -no-cups -depths 16 \
-qt-kbd-linuxinput -nomake demos -nomake examples \
-qt-mouse-linuxinput -qt-mouse-tslib \
-confirm-license -silent
I execute make and it fails part way through:
arm-linux-gnueabi-g++ -c -include .pch/release-shared-emb-arm/QtCore -pipe -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_EDITION=QT_EDITION_DESKTOP -DQT_EVAL -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION -DELF_INTERPRETER=\"/lib/ld-linux.so.2\" -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -I../../mkspecs/qws/linux-arm-gnueabi-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared-emb-arm -Iglobal -I../3rdparty/zlib -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -Iglobal -I.moc/release-shared-emb-arm -I/home/anh/tslib-arm/include -o .obj/release-shared-emb-arm/qsocketnotifier.o kernel/qsocketnotifier.cpp
{standard input}: Assembler messages:
{standard input}:1710: Error: selected processor does not support Thumb mode `swp r6,r4,[r3]'
a little further down
make[1]: *** [.obj/release-shared-emb-arm/qobject.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/anh/qt-everywhere-commercial-src-4.7.3/src/corelib'
make: *** [sub-corelib-make_default-ordered] Error 2
How can I resolve this? I feel as though this bug is relevant to my problem: http://bugreports.qt.nokia.com/browse/QTBUG-15911?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel#issue-tabs, but I don’t understand enough to be sure or know if I can use a workaround. Any help would be appreciated!
Thanks
4 replies
July 21, 2011
koahnig
Mad Scientist
1151 posts
link Welcome to this forum
You probably need to check the source code file “kernel/qsocketnotifier.cpp” for some preprocessor if around the point error. This might give some hints, what is going wrong.
July 22, 2011
anht
Lab Rat
3 posts
link Thanks koahnig.
I had a look at this file and I didn’t see anything that seemed useful to me.
I think my problem relates to the identified issue here:
https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/490371
https://bugreports.qt.nokia.com//browse/QTBUG-16402
and also
https://bugs.launchpad.net/ubuntu/+source/gcc-4.4-armel-cross/+bug/683832
I tried the -marm workaround suggested in that last link by adding the following lines to make qmake.conf
QMAKE_CFLAGS = -marm
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
which now makes it fail with the following errors:
image/qimage_neon.cpp: In function ‘void qt_convert_rgb888_to_rgb32_neon(quint32*, const uchar*, int)’:
image/qimage_neon.cpp:47:18: error: ‘uint8x8_t’ does not name a type
image/qimage_neon.cpp:63:23: error: ‘fullVector’ was not declared in this scope
…
In file included from painting/qdrawhelper_neon.cpp:31:0:
/usr/lib/gcc/arm-linux-gnueabi/4.5.2/include/arm_neon.h:32:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
I’ll try to look a bit further into resolving this new error but it seems to be something specific to compiling for ARM.
July 22, 2011
koahnig
Mad Scientist
1151 posts
link Hi
at the moment there is not a lot I can do to assist you in this problem. This is outside of my experience.
However, I have noted something in the information you have provided.
Initially you started out with Qt4.7.3 in the first post.
Here
anht wrote:
In file included from painting/qdrawhelper_neon.cpp:31:0:
/usr/lib/gcc/arm-linux-gnueabi/4.5.2/include/arm_neon.h:32:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
the error message refers to version 4.5.2.
Could it be that you are dealing with a mix of different Qt version?
You might want to check this and ensure that you are using only one specific version.
July 25, 2011
anht
Lab Rat
3 posts
link Thanks, but the 4.5.2 refers to the version of the arm-linux-gnueabi compiler I am using, not Qt.
我感觉是编译器问题,果断换了原先的4.3.2编译器,这次顺利完成编译。
----------------------------------------------------------先割一下---------------------------------------------------------------------------
完成上述后,在安装目录opt下会有qt的文件夹QtEmbedded-4.7.3
将QtEmbedded-4.7.3拷贝到我的nfs的文件系统opt文件夹下,现在qt已经移植基本结束了。
下面写配置文件:tslib.sh 我是将自己移植的tslib1.4与qt4.7.3的配置文件写在一起了.
#!/bin/sh
export TSLIB_ROOT=/opt/tslib
export TSLIB_TSDEVICE=/dev/touchscreen-1wire
export TSLIB_CALIBFILE=$TSLIB_ROOT/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CONSOLEDEVICE=/dev/tty
export TSLIB_FBDEVICE=/dev/fb0
export QTDIR=/opt/QtEmbedded-4.7.3
export QWS_MOUSE_PROTO=tslib:/dev/touchscreen-1wire
export QT_QWS_FONTDIR=/opt/QtEmbedded-4.7.3/lib/fonts
export QWS_DISPLAY=LinuxFb:/dev/fb0
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$QTDIR/lib:/opt/tslib/lib
在执行 source tslib.sh更新一下就行了。
至此,qt4.7.3移植完成。
移植好了当然要测试,下面编一个简单的 helloworld 测试一下。
在我的另一篇qt移植http://blog.csdn.net/yf210yf/article/details/6703619写的不是很详细。下面详细写一下:
1.装qt SDK,将Qt_SDK_Lin32_offline_v1_1_2_en.run拷贝到指定目录,并进入目录执行
chmod u+x Qt_SDK_Lin32_offline_v1_1_2_en.run
./Qt_SDK_Lin32_offline_v1_1_2_en.run
即可安装qt开发的SDK
2.关于helloworld的创建我就不多说了,见我另一篇博客http://blog.csdn.net/yf210yf/article/details/6703619
3.主要说下arm编译工具链的设置,点击工具-》选项,按下图设置
4.再项目中选择刚才添加的工具链,编译工程
5.将编译好的hello文件放到nfs的文件系统中,执行./hello -qws
图像出来了,与pc版的相比
字体还是有问题的,这是因为qt的字体库还不全,当然解决的方法会在后面的博客中介绍。先休息下。。。。。
欢迎转载:转载注明出处:袁方的技术博客http://blog.csdn.net/yf210yf/article/details/7354215