arm-linux-gcc-4.3.2编译qtopia-2.2.0报很多错误
前几天在PC机上编译了qtopia-4.5.2,能够运行单独的界面程序,但是找了很多资料都不知道如何运行桌面程序。原本想再mini2440上运行QT4的,现在只得转向QT2了,这个编译后有qpe,运行它就可以进入桌面。
本来友善之臂已经提供编译好的qtopia-2.2.0了,但是考虑到mini2440只是用来学习,如果换个平台要运行QT,那就得自己移植,所以自己移植qtopia-2.2.0。我刚开始用的是arm-linux-gcc-2.95.3的编译器,编译qtopia-2.2.0是可以通过,并且qtopia-2.2.0的源文件不需修改,但是放到我的根文件系统运行时却出现问题,原因是我使用的是linux-2.6.29.1内核版本,内核和根文件系统用的arm-linux-gcc-4.3.2。就这样被不同的编译器版本折腾了一下。这还不算,在使用arm-linux-gcc-4.3.2编译qtopia-2.2.0时到处都是错误,重复的删除、修改、编译了很多次,结果还是编译不过。我是在虚拟机下安装的fedora9,下面是我用arm-linux-gcc-4.3.2编译qtopia-2.2.0的步骤:
1、分别编译e2fs、jpeg、zlib、libpng、tslib库;
2、编译qtopia-2.2.0
(1)、参照韦哥《嵌入式Linux应用开发完全手册》一书P504,使用arm-linux-gcc-3.2后的高版本编译器时修改qtopia-2.2.0的源代码,我是手动修改的,没有实用补丁。
(2)、设置环境变量,脚本setenv.sh内容如下:
export QPEDIR=/home/qtopia-arm/qtopia
export QTDIR=/home/qtopia-arm/qt2
export LD_LIBRARY_PATH=$QTDIR/libQPEDIR/libLD_LIBRARY_PATH
export TMAKEDIR=/home/qtopia-arm/tmake
export TMAKEPATH=$TMAKEDIR/lib/qws/linux-arm-g++
(2)、修改/home/qtopia-arm/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf
将QMAKE_LIB_QT=-lqte
改为
QMAKE_LIB_QT=-lqte -lpng -lts -lz -luuid -ljpeg
修改$QPEDIR/src/qt/qconfig-qpe.h文件,定义相应的宏,在最后加上
#define QT_QWS_IPAQ
#define QT_QWS_IPAQ_RAW
修改$QPEDIR/src/qt/qconfig-qpe.h文件
注释如下部分:
/*
#ifndef QT_NO_QWS_CURSOR
#define QT_NO_QWS_CURSOR
#endif
#ifndef QT_NO_QWS_MOUSE_AUTO
#define QT_NO_QWS_MOUSE_AUTO
#endif
#ifndef QT_NO_QWS_MOUSE_PC
#define QT_NO_QWS_MOUSE_PC
#endif
*/
(3)、cp $QPEDIR/src/qt/qconfig-qpe.h $QTDIR/src/tools
cd $QPEDIR/src/libraries/qtopia
cp custom-linux-ipaq-g++.cpp custom-linux-arm-g++.cpp
cp custom-linux-ipaq-g++.h custom-linux-arm-g++.h
(4)、配置
echo 'yes'|./configure -qte '-embedded -xplatform linux-arm-g++ -qconfig qpe -no-qvfb -depths 16,24,32 -system-jpeg -system-libpng -system-zlib -tslib -gif -thread -debug -no-opengl -no-xft -I/home/arm/include -L/home/arm/lib -lpng -lts -lz -luuid -ljpeg' -qpe '-xplatform linux-arm-g++ -edition pda -displaysize 240x320 -I/home/arm/include -L/home/arm/lib -prefix=/home/Qtopia' -qt2 '-no-xft' -dqt '-no-xft'
source setenv.sh
(5)、编译
make
编译时出现很多错误,下面列出这些错误:
1、../tools/qutfcodec.cpp:191: 警告:建议在 || 的操作数中出现的 && 前后加上括号
/home/qtopia-arm/qt2/include/qimage.h:58: 警告:建议在 || 的操作数中出现的 && 前后加上括号
qvfb.cpp: In member function ‘void AnimationSaveWidget::convertToMpeg(QString)’:
qvfb.cpp39: 警告:函数调用中缺少哨兵
g++ -c -I/home/qtopia-arm/qt2/include -pipe -O2 -Wall -W -DNO_DEBUG -I/home/qtopia-arm/qt2/src/3rdparty/libpng -o qvfbview.o qvfbview.cpp
qvfbview.cpp:39:22: 错误:asm/page.h:没有那个文件或目录
In file included from qvfbview.cpp:27:
/home/qtopia-arm/qt2/include/qimage.h: In member function ‘int QImageTextKeyLang:/home/qtopia-arm/qt2/include/qimage.h:58: 警告:建议在 || 的操作数中出现的 && 前后加上括号
qvfbview.cpp: In constructor ‘QVFbView:qvfbview.cpp:138: 错误:‘PAGE_SIZE’在此作用域中尚未声明
make[1]: *** [qvfbview.o] 错误 1
make[1]: Leaving directory `/home/qtopia-arm/qt2/tools/qvfb'
这些错误出现在编译过程中出现很多次,只找到那个警告所在的源代码处,其它的不知道如何改。
2、kernel/qpixmapcache.cpp:539: error: 'PAGE_SIZE' was not declared in this scope
kernel/qpixmapcache.cpp:539: error: 'PAGE_MASK' was not declared in this scope
kernel/qpixmapcache.cpp: In member function 'void QSharedMemoryManager::internal_free(QSMemPtr)':
kernel/qpixmapcache.cpp:773: error: 'PAGE_SIZE' was not declared in this scope
kernel/qpixmapcache.cpp:773: error: 'PAGE_MASK' was not declared in this scope
make[1]: *** [tmp/release-shared-linux-arm-g++-no-keypad/kernel/qpixmapcache.o] 错误 1
这个错误对应上面的“asm/page.h:没有那个文件或目录”。
3、L/home/qtopia-arm/qt2/lib -lqte -lpng -lts -lz -luuid -ljpeg
/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lqte
collect2: ld returned 1 exit status
make[5]: *** [../../../lib/libqpe.so.1.5.3] 错误 1
make[5]: Leaving directory `/home/qtopia-arm/qtopia/src/libraries/qtopia'
make[4]: *** [all] 错误 2
make[4]: Leaving directory `/home/qtopia-arm/qtopia/src/libraries/qtopia'
make[3]: *** [sub-libraries-qtopia] 错误 2
make[3]: Leaving directory `/home/qtopia-arm/qtopia/src'
make[2]: *** [all] 错误 2
make[2]: Leaving directory `/home/qtopia-arm/qtopia/src'
make[1]: *** [all] 错误 2
make[1]: Leaving directory `/home/qtopia-arm/qtopia'
这是最后面的错误信息。
看了这些错误信息,不知道该改哪里,在网上找了资料,多数都是使用arm-linux-gcc-2.95.3来编译的,所以很少有人出现这些错误,有一些使用4.3.2来编译的,但是介绍的太少了,没有介绍这些的。
恳请有这方面经验的指点一下,谢谢!