原來雖然移植過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://www.linuxidc.com/Linux/2012-03/56661.htm。
步驟:
(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.