转:http://blog.csdn.net/xuehui869/article/details/8958311
运行主机:ubuntu 32位 11.04
QT版本:2.2.0
开发板:TQ2440
源码安装路径(修改相关脚本x86-qtopia-2.2.0_build等,摈弃了解压缩后的文件都放在/opt/EmbedSky/Qte的问题):/opt/newSSD/tq2440/source/Qte
GCC版本:3.4.4
说明:鉴于网上的讨论-------------------ubuntu11.04自带的gcc4.5.2编译Qt2.2.0会出现很多问题,所以把GCC的版本降低,出现的错误大大减少。参考文献:http://jinsuo2007.blog.163.com/blog/static/1922799520104137259556/
1. 安装GCC(包含G++)3.4.4
安装方法参考《ubuntu10.4系统下GCC降级安装》
下载地址http://mirror.bjtu.edu.cn/gnu/gcc/gcc-3.4.4/
先解压
$ ./configure --prefix=/opt/newSSD/tq2440/compile/gcc-3.4.4/ --mandir=/opt/newSSD/tq2440/compile/gcc-3.4.4/share/man --infodir=/opt/newSSD/tq2440/compile/gcc-3.4.4/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++
$ make && make install
2. 编译错误
错误:asm/page.h:没有那个文件或目录 In file included from kernel/qgfx_qws.h:39,
解决办法:
http://tensing.blog.sohu.com/114887954.html
从linux2.6.25.8拷贝出linux-2.6.25.8/include/asm-x86/page.h放在/usr/include/asm目录下即可
3. 编译出现错误:
/usr/bin/ld: cannot find -luuid
/usr/bin/ld: cannot find -lqte
collect2: ld 返回 1
make[5]: *** [../../../lib/libqpe.so.1.5.3] 错误 1
make[5]:正在离开目录 `/opt/newSSD/tq2440/source/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
make[4]: *** [all] 错误 2
make[4]:正在离开目录 `/opt/newSSD/tq2440/source/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
make[3]: *** [sub-libraries-qtopia] 错误 2
make[3]:正在离开目录 `/opt/newSSD/tq2440/source/Qte/x86-qtopia-2.2.0/qtopia/src'
make[2]: *** [all] 错误 2
make[2]:正在离开目录 `/opt/newSSD/tq2440/source/Qte/x86-qtopia-2.2.0/qtopia/src'
make[1]: *** [all] 错误 2
make[1]:正在离开目录 `/opt/newSSD/tq2440/source/Qte/x86-qtopia-2.2.0/qtopia'
解决方法:http://blog.csdn.net/mimicock1234/article/details/7402453
$locate libuuid
/lib/i386-linux-gnu/libuuid.so.1
/lib/i386-linux-gnu/libuuid.so.1.3.0
$ln -sf /lib/i386-linux-gnu/libuuid.so.1.3.0 /usr/lib/libuuid.so
4. 错误
/usr/lib/libGLU.so: undefined reference to `operator delete(void*)@GLIBCXX_3.4'
/usr/lib/libGLU.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info@CXXABI_1.3'
/usr/lib/libGLU.so: undefined reference to `__gxx_personality_v0@CXXABI_1.3'
/usr/lib/libGLU.so: undefined reference to `operator delete[](void*)@GLIBCXX_3.4'
/usr/lib/libGLU.so: undefined reference to `operator new(unsigned int)@GLIBCXX_3.4'
/usr/lib/libGLU.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info@CXXABI_1.3'
/usr/lib/libGLU.so: undefined reference to `__cxa_pure_virtual@CXXABI_1.3'
/usr/lib/libGLU.so: undefined reference to `vtable for __cxxabiv1::__class_type_info@CXXABI_1.3'
/usr/lib/libGLU.so: undefined reference to `operator new[](unsigned int)@GLIBCXX_3.4'
collect2: ld 返回 1
make[1]: *** [../../../bin/lrelease] 错误 1
make[1]:正在离开目录 `/opt/newSSD/tq2440/source/Qte/x86-qtopia-2.2.0/dqt/tools/linguist/lrelease'
-----------------------这个问题不影响编译
5.
videocaptureview.cpp:54:28: linux/videodev.h:没有那个文件或目录
videocaptureview.cpp:90: 错误: field `caps' has incomplete type
videocaptureview.cpp:91: 错误: field `mbuf' has incomplete type
解决办法:
http://blog.csdn.net/r91987/article/details/6849730
$apt-get install libv4l-dev
$ vi x86-qtopia-2.2.0/qtopia/src/applications/camera/videocaptureview.cpp
#include <linux/videodev.h>
替换为
#include <libv4l1-videodev.h>
6.
opt/EmbedSky/Qte/pro/build
mv: 无法获取"pro" 的文件状态(stat): 没有那个文件或目录
Build user program , please wait ...
./x86-qtopia-2.2.0_build: 第 45 行: cd: x86-qtopia-2.2.0/pro: 没有那个文件或目录
./x86-qtopia-2.2.0_build: 行 46: ./build: 没有那个文件或目录
解决办法:
发现原因是x86-qtopia-2.2.0_build脚本里的解压路径不对,改正即可。
------------------------------以下,Qt就可以运行了。
7.
qpe运行时
qpe: error while loading shared libraries: libqtopia2.so.2: cannot open shared object file: No such file or directory。。。。。
http://blog.csdn.net/chenah/article/details/5216308
解决办法:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib