经过5天努力。每天都到凌晨,我的努力终于得到了回报。在板子上成功的移植了qtopia 2.2.0
其中linux装了n多遍。每个版本之前都有细微差别,编译x86版本时候基本都没问题,但是交叉编译时候问题总是很多。
开始用的arm-linux-gcc-3.4.1,虽然在Red Hat Enterprise Linux 5<<以下简称rhel>> 和 suse 10.3 <<简称suse>>都能交叉编译成功.但是在板子上运行的时候就是有些不对,请看下图.
这是在板子上运行的效果,每个图标上都有一条或者说是一排小点.
在网上也是看别人用arm-linux-gcc-2.95.3.的比较多,于是立刻删了重新装.
本文最后成功就是基于
环境:
友善micro2440板子,
Red Hat Enterprise Linux 5 (最好不要用redhat9 太老了。。甚至编译qt2时候错误提示都没)
vmware5
编译器版本:
x86-gcc-3.4.1 (最好是3.4.1 高了的话会有各种编译错误,还要修改代码)
arm-linux-gcc-2.95.3
ftp://ftp.arm.linux.org.uk/pub/linux/arm/toolchain/cross-2.95.3.tar.bz 需要软件版本
qtopia-free-src-2.2.0.tar.gz
ftp://ftp.trolltech.com/pub/qt/source/qtopia-free-src-2.2.0.tar.gz e2fsprogs-1.39.tar.gz
http://nchc.dl.sourceforge.net/sourceforge/e2fsprogs/e2fsprogs-1.39.tar.gz jpegsrc.v6b.tar.tar
http://superb-east.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.14.tar.bz2 libpng-1.2.14.tar.bz2
http://superb-east.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.14.tar.bz2 zlib-1.2.3.tar.gz
http://www.zlib.net/zlib-1.2.3.tar.gz 过程参见
http://blog.chinaunix.net/u1/55409/showart_434344.html 这个是加入了第三方tslib触摸支持,可以不要.
http://www.mtime.com/my/rylex/blog/1410413/ 这个有详细qtopia自己对触摸的支持.
这两个参考足够。
我谈一下可能遇到的问题
1.编译jpeg 时候没有生成libjpeg.a:
请在configure时加上红色部分.
./configure --enable-shared --enable-static
2.qtopia编译过程经常缺库
在qiotia编译时找不到某某lxxx.so,手动在configure里面加入-L/opt/micro2440/arm-qtopia/lib (只是比方。你要看你的e2fsprogs libpng libjpeg zlib目录在什么地方)
这是我的configure
./configure -dqt '-no-xft' -qte '-embedded -no-xft -xplatform linux-arm-g++ -qconfig qpe -depths 16,32 -no-qvfb -system-jpeg -gif -I/opt/micro2440/arm-qtopia/include -L/opt/micro2440/arm-qtopia/lib' -qpe '-xplatform linux-arm-g++ -edition pda -displaysize 240x320' -libpath $PWD/lib -prefix $PWD/target
看标记颜色就知道结构了。
绿色是它里面的
-dqt=dqt
选项:'-no-xft'
dqt中的-no-xft一定加上。否侧rhel中freetype版本高于dqt需要的。编译是要报错。 如下
在包含自 3rdparty/opentype/ftxopentype.c:3 的文件中:
3rdparty/opentype/ftxopen.c:18:40: 错误:freetype/internal/ftstream.h:没有那个文件或目录
3rdparty/opentype/ftxopen.c:19:40: 错误:freetype/internal/ftmemory.h:没有那个文件或目录
3rdparty/opentype/ftxopen.c:20:39: 错误:freetype/internal/tttypes.h:没有那个文件或目录
之所以产生这个问题是由于开发机本身的freetype版本与qtopia所使用的版本不一致所造成的,qtopia-free-2.2.0所需要的freetype的版本为:freetype-2.1.10
-qte=qt2
选项:'-embedded -no-xft -xplatform linux-arm-g++ -qconfig qpe -depths 16,32 -no-qvfb -system-jpeg -gif -I/opt/micro2440/arm-qtopia/include'
其中-I/opt/micro2440/arm-qtopia/include 就是手动指定头文件位置。
-L/opt/micro2440/arm-qtopia/lib 手动指定库位置。
大部分的编译错误都和库有关,所以请多加小心。看看是不是库的位置不对。
另外几个必须加上,我不解释了
-qpe=qtopia
选项:'-xplatform linux-arm-g++ -edition pda -displaysize 240x320'
指的是编译成arm平台,pda版本。分辨率240x320
对应的代码作用。
qtopia:Contains all qtopia source code.
qt2 :Contains the Qt 2.3.x source code that compiles for both X11 and embedded configurations. dqt Contains Qt-x11- 3.3.x sources. Qt-x11-3.x is used to build certain tools such as Assistant and Linguist as well as providing a Qt :for Qtopia Desktop to build against.
3.我遇到个奇怪问题,。在编译arm-qtopia/qoptia/src/tools/qdawggen/目录时找不到lib-mt.so。
并没有提示找不到这个库但是很多的“undefined reference”说明就是链接错误。
解决方法:手动指定位置在/usr/lib/qt-3.3/lib/lib-mt.so.3.3.6
还有貌似是便衣之前不要指定QTDIR。(貌似。。。)
暂时这就是我遇到的问题,大多时候还是和库有关系。和很多都有关系,在suse还有另外的问题。真的不想解决了。环境配置太麻烦了。
要静下心来看错误提示,然后google或者baidu。
5天的折腾。没有白费,有了很成果很高兴。再遇到什么问题慢慢更新。