ubuntu 10.04下成功编译Qtopia2.2.0

来源:互联网 发布:改键位软件 编辑:程序博客网 时间:2024/05/17 07:43

【转】ubuntu 10.04下成功编译Qtopia2.2.0



环境是ubuntu 10.04,编译器是gcc3.3.6版本,系统自带的编译出来的错误太多。至于怎么换编译器版本,网上有太多的我这就不多说了。arm-linux-gcc版本是天嵌公司给的4.3.3版本。Qtopia2.2.0是天嵌公司给的。
1、首先进入管理员状态:sudo su
这时进入管理员状态root@ubuntu:/opt/EmbedSky/Qte#,这个#代表是管理员。如果是在普通用户下是me@ubuntu:~$ ,是$,在普通用户下也会产生许多问题。
2、进入管理员状态后的环境变量和普通用户是不一样的,可以echo $PATH看看。添加arm-linux-gcc的环境变量。export PATH=$PATH:/opt/EmbedSkye/4.3.3/bin

3、可能出现的错误:

错误一

致命错误: X11/Xlib.h:没有那个文件或目录

修正的方法:
$ sudo apt-get install libxpm-dev


错误二

“make: g++:命令未找到”解决办法

sudo apt-get install g++ 

sudo apt-get install pentium-builder

错误三

make[5]: /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/uic: Command not found
make[5]: *** [../../../include/qtopia/private/passwordbase_p.h] Error 127
make[5]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
make[3]: *** [sub-libraries-qtopia] Error 2
make[3]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src'
make[2]: *** [install] Error 2
make[2]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia'
 done !
cp: cannot create regular file `qtopia/image/opt/Qtopia/lib/fonts/': No such file or directory


从网上找,说是要安装qt-x11,于是从网上下载了相关的安装包qt-everywhere-opensource-src-4.6.2.tar.gz 安装,但
安装qt-x11(主要是为了得到assistant ,designer ,qvfb,uic 等工具)

编译安装qt-x11到/usr/local/qt-x86目录
解压:tar xzvf  qt-everywhere-opensource-src-4.6.2.tar.gz,复制得到三份相同文件,目录分别为qt-x11, qte-x86, qte-arm
进入解压目录: cd qt-x11
配置:./configure -prefix /usr/local/qt-x86 -qvfb
此时出现了问题:
Basic XLib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/zhu/Qt/qt-x11-opensource-src-4.5.2/mkspecs/linux-g++
查找资料,发现需要安装libX11的开发包--libX11-dev libXext-dev libXtst-dev,于是下载安装。待续...
 
继续补充:
sudo apt-get install libX11-dev libXext-dev libXtst-dev  uuid-dev

然后
./configure -prefix /usr/local/qte-x86 -qvfb

make                                     //这个过程非常久,我用了一个多小时

make install


错误四
在编译x86-qtopia-2.2.0-konqueror_build时里面提到的两个编译错误都会碰到,当然有可能会碰到库不全的情况,错误会更多。至于哪些库我也记不清了。这是库已完全安装的情况下的产生的错误的解决办法。在编译天嵌公司的arm-qtopia-2.2.0-konqueror_build也会碰到类似的错误。解决方法一样。主要就是要更改qmemoryfile_unix.cpp里面的一个函数的参数。
fPIC  -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"qpe\" -DQTOPIA_TRTARGET=\"libqpe\" -DQT_NO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/mkspecs/qws/linux-generic-g++ -I. -I../../../include/qtopia/private -I../../../pics/qpe -I../../../include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I../../../include/qtopia/private/ -I.moc/release-shared/ -o .obj/release-shared/qmemoryfile_unix.o qmemoryfile_unix.cpp
qmemoryfile_unix.cpp: In member function ‘QMemoryFileData* QMemoryFile:openData(const QString&, int, uint)’:
qmemoryfile_unix.cpp:149: warning: format not a string literal and no format arguments
qmemoryfile_unix.cpp:187: warning: format not a string literal and no format arguments
qmemoryfile_unix.cpp:232: warning: format not a string literal and no format arguments
In file included from /usr/include/fcntl.h:217,
from qmemoryfile_unix.cpp:48:
In function ‘int open(const char*, int, ...)’,
inlined from ‘QMemoryFileData* QMemoryFile:openData(const QString&, int, uint)’ at qmemoryfile_unix.cpp:141:
/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
make[5]: *** [.obj/release-shared/qmemoryfile_unix.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/qmemoryfile_unix.cpp 141行

if (!f)
f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY);   
修改为
if (!f)
f = ::open(tmpFile.latin1(), O_CREAT | O_WRONLY, 0666); 


make[5]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -fPIC  -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"qpe\" -DQTOPIA_TRTARGET=\"libqpe\" -DQT_NO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/mkspecs/qws/linux-generic-g++ -I. -I../../../include/qtopia/private -I../../../pics/qpe -I../../../include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I../../../include/qtopia/private/ -I.moc/release-shared/ -o .obj/release-shared/vobject.o backend/vobject.cpp
backend/vobject.cpp: In function ‘VObject* addGroup(VObject*, const char*)’:
backend/vobject.cpp:419: error: invalid conversion from ‘const char*’ to ‘char*’
backend/vobject.cpp: In function ‘void writeEncString(OFile*, const char*, bool)’:
backend/vobject.cpp:1111: warning: suggest parentheses around ‘&&’ within ‘||’
backend/vobject.cpp: In function ‘bool includesUnprintable(VObject*, bool)’:
backend/vobject.cpp:1168: warning: suggest parentheses around ‘&&’ within ‘||’
backend/vobject.cpp:1169: warning: suggest parentheses around ‘&&’ within ‘||’
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,'.');

4、konqueror的编译
上面是原作者的解决办法。能够成功编译,但是在编译konqueror时就会出现错误 setQpeEnv: not found。这是无法读取目录下的setQpeEnv脚本所致。首先天嵌的x86-qtopia-2.2.0-konqueror_build也没什么逻辑上的错误,但是无法读取确实很让人奇怪。
解决办法:在终端的/opt/EmbedSky/Qte/目录下手动执行source ./x86-qtopia-2.2.0/setQpeEnv,再运行 ./x86-qtopia-2.2.0-konqueror_build,就成功编译了。
上面的问题在编译./arm-qtopia-2.2.0-konqueror_build也会遇到,解决办法一样。

原创粉丝点击