本人编译过程中遇到的问题,汇总如下:
使用源码:
mini210光盘自带的x86-qtopia-20100420.tar.gz
配置参数:(绿色部分为修改部分,1.修改尺寸2.加入对luuid的链接)
echo yes | ./configure -qte '-embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif' -qpe '-edition pda -displaysize 800x480 -luuid -fontfamilies "helvetica fixed micro smallsmooth smoothtimes"' -qt2 '-no-opengl -no-xft' -dqt '-no-xft -thread'
由于Ubuntu12.04很多库和软件都没有安装,所以最好直接安装后再进行编译
atp-get install g++
apt-get install libx11-dev libxext-dev libxtst-dev
apt-get install uuid-dev
apt-get install libxmu-dev libxmu6
apt-get install libxpm-dev
遇到问题
1.backend/vobject.cpp: In function ‘VObject* addGroup(VObject*, const char*)’:
backend/vobject.cpp:419: error: invalid conversion from ‘const char*’ to ‘char*’
make[5]: *** [.obj/release-shared/vobject.o] Error 1
make[5]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
解决方法:
修改/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia/backend/vobject.cpp:419行
char *dot = strrchr(g,'.');
为
char *dot = (char*)strrchr(g,'.');
2.
wavplugin.cpp: 在成员函数‘virtual bool WavPlugin::isFileSupported(const QString&)’中:
wavplugin.cpp:435:45: 错误:从类型‘const char*’到类型‘char*’的转换无效
解决方法:
修正/x86-qtopia-2.2.0/qtopia/src /plugins/codecs/wavplugin/wavplugin.cpp:435行
char *ext = strrchr( path.latin1(), '.' );
为 char *ext = (char*)strrchr( path.latin1(), '.' )
3. undefined reference to `uuid_generate'
collect2: ld returned 1 exit status
下载e2fsprogs-1.39
链接地址http://jaist.dl.sourceforge.net/project/e2fsprogs/e2fsprogs/1.39/e2fsprogs-1.39.tar.gz
#cd e2fsprogs-1.39
#./configure --enable-elf-shlibs
#make
#make install
单独如此修改还不够,还会报此错误。问题根本原因是没有链接luuid库。有人说在。最直接的方法是在开始的配置文件中加入“-luuid”
echo yes | ./configure -qte '-embedded -no-xft -qconfig qpe -depths 16,32 -system-jpeg -gif' -qpe '-edition pda -displaysize 800x480 -luuid -fontfamilies "helvetica fixed micro smallsmooth smoothtimes"' -qt2 '-no-opengl -no-xft' -dqt '-no-xft -thread'
4.
../include/qmap.h:107:13: 错误: ‘ptrdiff_t’不是一个类型名
../include/qmap.h:223:13: 错误: ‘ptrdiff_t’不是一个类型名
In file included from kernel/qmime.h:43:0,
from kernel/qevent.h:45,
from kernel/qobject.h:45,
from kernel/qwidget.h:43,
from kernel/qdesktopwidget.h:40,
from kernel/qapplication.h:42,
from kernel/qapplication_x11.cpp:64:
../include/qmap.h:604:13: 错误: ‘ptrdiff_t’不是一个类型名
解决方法:
在 qtopia-free-2.2.0/dqt/include/路径下
打开qmap.h
添加
#include <stddef.h> //注意此处不是引号“”
#include <cstddef>
保存退出
再在同样的路径下打开qvaluelist.h添加
#include <stddef.h> //注意此处不是引号“”
#include <cstddef>主要用strrchr函数时,从类型‘constchar*’到类型‘char*’的转换无效,新版本g++不支持报错了。
5.编译错误:open函数参数不够
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
解决办法:
在Ubuntu 12.04上, gcc会严格检查open()的参数传递,如果第二个参数为O_CREAT的话(就像qtopia-2.2.0-FriendlyARM/qt2/src /tools/qmemoryfile_unix.cpp的143行这样),必须传入第三个参数mode。因此,手动修改x86-qtopia- 2.2.0/qt2/src/tools/qmemoryfile_unix.cpp 143行将
if (!f)
f = open(tmpFile.latin1(), O_CREAT | O_WRONLY);
修改为
if (!f)
f = open(tmpFile.latin1(), O_CREAT | O_WRONLY, 0666);
6.
videocaptureview.cpp:54:28: linux/videodev.h:没有那个文件或目录
videocaptureview.cpp:90: 错误: field `caps' has incomplete type
videocaptureview.cpp:91: 错误: field `mbuf' has incomplete type
解决办法:
$apt-get install libv4l-dev
cd /usr/include/linux
ln -s ../libv4l1-videodev.h videodev.h