编译qt4.7.3 遇到的问题
交叉编译器 arm-linux-gcc3.4.5
系统环境ubuntu 10.04
前提要编译好tslib的ARM库,为的是后面编译qt时使用-qt-mouse-tslib 有相关的依赖库
tslib 用这个配置
./configure--prefix=/home/skywalker/armts--host=arm-linux
ac_cv_func_malloc_0_nonnull=yes
#make
#make install
而qt4.7我用这个配置
../configure -prefix /home/skywalker/armqt -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/home/skywalker/armts/include -L/home/skywalker/armts/lib
-D__ARM_ARCH_5TEJ__
#make
make时首先遇到
../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:131:
Error: no such instruction: `swpb %cl,%dl,[�i]'
观察编译过程,是在编译qmake时就没有通过,
在网上找到的方法,可以在configure的"Creating Makefile please
wait"8583行加上OPT_FAST=no ,然后从新configure一遍,据说是makefile
的一个bug,configure 没有重新生成makefile.
还有一个办法就是用c代替汇编 具体如下.
可以避过这个错误。
在src/corelib/arch/qaatomic_arm.h
131行
inline char q_atomic_swp(volatile char *ptr, char
newval)
{
register char ret;
ret=*ptr;
*ptr=newval;
return ret;
}
在228行
template
T>
Q_INLINE_TEMPLATE T
*QBasicAtomicPointer::fetchAndStoreOrdered(T
*newValue)
{
T *originalValue;
originalValue=_q_value;
_q_value=newValue;
return originalValue;
}
建议用这个方法不然后面又遇到这个问题
编译到第三方库javascript时遇到这个错误,可以直接在配置仕加上这个 -no-javascript-jit
不过好像没啥用
n file included from
../3rdparty/javascriptcore/JavaScriptCore/config.h:26,
from
../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_compile.cpp:44:
../3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:320:6:
#error "Not supported ARM architecture"
我的解决办法是 在configure 时在后面加上 -D__ARM_ARCH_5TEJ__ ,问题就解决了
但是新的问题又来了这是因为上面我用了第一种方法修改在configure的文件,最后编译demo的时候又出现最初遇到的问题如下,于是安照注释汇编用C来代替的方法就可以编译通过了
../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:
Assembler messages:
../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:131:
Error: no such instruction: `swpb %dl,%al,[%esi]'
有的人还会遇到这个问题,因为我之前已经改过所以我没有出现下面的问题
.QFontEngineFT::init(QFontEngine::FaceId, bool,
QFontEngineFT::GlyphFormat)':
text/qfontengine_ft.cpp:696: warning: initialization to `int' from
`qreal'
text/qfontengine_ft.cpp:696: warning: argument to `int' from
`qreal'
{standard input}: Assembler messages:
{standard input}:1587: Error: register or shift expression expected
-- `orr r3,r2,lsl#16'
{standard input}:1597: Error: register or shift expression expected
-- `orr r2,r3,lsl#16'
{standard input}:3206: Error: register or shift expression expected
-- `orr r3,r1,lsl#16'
{standard input}:3219: Error: register or shift expression expected
-- `orr r3,ip,lsl#16'
临时解决方案:
To fix this issue patch
/src/3rdparty/freetype/include/freetype/config/ftconfig.h Line
330.
(原来的为) "orr %0, %2, lsl #16\n\t"
(修改后为) "orr %0, %0, %2, lsl #16\n\t"
以上为使用arm-linux-gcc3.4.5编译,虽然可以编译通过,但是移植到开发板后,运行一个例子程序会出现以下一些错误,
QString::arg: Argument missing: "/proc/%1/exe"
, 480
Qtig:r:Agmn isn:"po/1ee
8
Qtig:r:Agmn isn:"po/1ee
8
Qtig:r:Agmn isn:%ted,/
Qtig:r:Agmn isn:"1qebde-2 ?????
Cno raeQ o meddLnxdt
ietr:%ted
Aborted
不知是什么问题,上网找了很久没找到答案,
不知是不是编译器太旧的原因,还是因为我的文件系统busybox是用arm-linux-gcc2.95编译,而qt4.7则用的是3.4.5的编译器,可能是编译器不统一,没办法了只能从新再编译一次.
下面我用arm-linux-gcc4.5.1编译器重新编译一遍
用以下配置和上面3.4.5的配置有点不同,依然是用上面的修改过的源码.
./configure -prefix /home/skywalker/armqt
-release -shared -fast -no-qt3support -qt-sql-sqlite -qt-libmng
-qt-freetype -no-openssl -nomake examples -nomake demos -nomake
tools -optimized-qmake -no-webkit -qt-libtiff -no-phonon -no-opengl
-no-cups -no-xcursor -no-neon -no-mouse-linuxtp -xplatform
qws/linux-arm-g++ -embedded arm -depths 16 -no-qvfb -qt-mouse-tslib
-I/home/skywalker/armts/include -L/home/skywalker/armts/lib
-D__ARM_ARCH_5TEJ__
编译顺利通过
关于qt环境的测试看我的下一篇文章