ubuntu10.10编译qtopia-2.2.0 问题总结及分析
configure, build, and install this package.?
Tell me:
configure == configure
make == build
make install == install
序:
我這幾天編譯Qtopia時積累了一些小經驗,把編譯錯誤大致分為三類錯誤:一、因環境變量不起作用及權限不足而導致 二、因缺少類庫或安裝包不全而導致 三、源代碼問題函數錯誤而導致。
由于編譯器版本太高,造成編譯Qtopia-2.2.0時,出錯很多,但是也只有這樣才能夠學習到東西,鍛煉分析問題,解決問題的能力.但是如果為了節約時間,強烈推薦使用低版本的編譯器。
以下為編譯x86-qtopia-2.2.0得出經驗,編譯arm-qtopia-2.2.0時出現的編譯錯誤也可以參考一下對對應內容自行修改。
編譯前提:
OS:ubuntu 10.10
GCC:4.3.3
DB:ARM9-TQ2440
SourceCode:Qtopia-2.2.0
首先安裝EABI并設置交叉編譯器的環境變量:
1、打開環境變量設置文件environment
zyx@zyx:~$?sudo gedit /etc/environment
2、在其中添加":/opt/EmbedSky/4.3.3/bin",修改后為
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/EmbedSky/4.3.3/bin"
3、使修改后的環境變量生效
zyx@zyx:~$?sudo source /etc/environment
一、因環境變量不起作用及權限不足出現編譯錯誤的解決辦法:
1.編譯錯誤:
zyx@zyx:~$?sudo ./x86-qtopia-2.2.0-konqueror_build
the qpe program is already !
the konqueror directory is already !
Build konqueror , please wait ...
.: 46: setQpeEnv: not found
原因:配置環境沒有起作用。
解決辦法:
在x86-qtopia-2.2.0-konqueror_build編譯腳本配置文件中
第26行 .setQpeEnv
改成 ./setQpeEnv?
重新編譯
若不起作用
繼續改成? source ./x86-qtopia-2.2.0/setQpeEnv
重新編譯
若仍不起作用
就直接將 /opt/EmbedSky/Qte/x86-qtopia-2.2.0/setQpeEnv
的內容 直接copy到此處,再將原來的注釋掉
重新編譯即可
2.編譯錯誤(此為arm編譯腳本運行時出現的錯誤):
chmod: cannot access `set*Env': No such file or directory
?done !
?done !
the konqueror directory is already !
Build konqueror , please wait ...
?
./arm-qtopia-2.2.0-konqueror_build: 58: source: not found
原因:配置環境沒有起作用。
解決辦法:
在arm-qtopia-2.2.0-konqueror_build編譯腳本配置文件中
第25行 source arm-qtopia-2.2.0/setQpeEnv 用#號注釋掉
直接將 /opt/EmbedSky/Qte/arm-qtopia-2.2.0/setQpeEnv
的內容 直接copy到此處,重新編譯即可。
3.編譯錯誤(此為arm編譯腳本運行時出現的錯誤):
make: arm-linux-g++: Command not found
make: *** [main.o] Error 127
make: arm-linux-g++: Command not found
make: *** [.obj/linux-arm-g++//filebrowser.o] Error 127
make: /opt/EmbedSky/Qte/arm-qtopia-2.2.0/qt2/bin/uic: Command not found
make: *** [settingsdialogbase.h] Error 127
make: arm-linux-g++: Command not found
make: *** [.obj/linux-arm-g++//TEScreen.o] Error 127
./arm-qtopia-2.2.0_build: line 69: cd: arm-qtopia-2.2.0/qtopia/image/opt/Qtopia/lib/fonts/: No such file or directory
mv: cannot stat `helvetica_120_50.qpf': No such file or directory
mv: cannot stat `helvetica_120_50_t5.qpf': No such file or directory
mv: cannot stat `bak_helvetica_120_50_t5.qpf': No such file or directory
mv: cannot stat `bak_helvetica_120_50.qpf': No such file or directory
cp: cannot stat `qtopia/image/opt': No such file or directory
chmod: cannot access `set*Env': No such file or directory
./arm-qtopia-2.2.0-konqueror_build: 55: source: not found
configure: WARNING: If you wanted to set the --build type, don't use --host.
??? If a cross compiler is detected then cross compile mode will be used.
configure: error: C compiler cannot create executables
See `config.log' for more details.
make: *** No targets specified and no makefile found.? Stop.
原因:安裝EABI時已安裝了交叉編譯器并設置了交叉編譯器的環境變量,也能夠通過命令找到arm-linux-g++和arm-linux-gcc,如下:
zyx@zyx:/opt/EmbedSky$?arm-linux-g++ -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/maxim/arm-lite/src-4.3-arm-none-linux-gnueabi-lite/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-176' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/libc --with-gmp=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176)
zyx@zyx:/opt/EmbedSky$?arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/maxim/arm-lite/src-4.3-arm-none-linux-gnueabi-lite/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-176' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/libc --with-gmp=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176)?
zyx@zyx:/opt/EmbedSky$
但是編譯的時候就是找不到交叉編譯器,這讓我很費解;后來在看到網上說有可能是權限不足,在根用戶下編譯時可以找到g++.這樣“configure: error: C compiler cannot create executables
See `config.log' for more details.make: *** No targets specified and no makefile found.? Stop.”的錯誤也迎刃而解。
解決辦法:使用根用戶重新編譯。
zyx@zyx:/opt/EmbedSky/Qte$?su
Password:?
root@zyx:/opt/EmbedSky/Qte# ./arm-qtopia-2.2.0-konqueror_build
4.編譯錯誤:
configure: error: Qt (>= Qt 2.2.2) (headers and libraries) not found. Please check your installation!
For more details about this problem, look at the end of config.log.
原因:出現此類錯有可能是下面講到的第二大類編譯錯誤第10個錯誤,但是并不一定都能解決問題。有時是用戶權限問題,改成根用戶重新編譯即可。
解決辦法:
zyx@zyx:/opt/EmbedSky/Qte$?su
Password:?
root@zyx:/opt/EmbedSky/Qte# ./x86-qtopia-2.2.0-konqueror_build
5.編譯錯誤:
Qtopia data directory is not owned by user 0:/tmp/qtopia-0
原因:權限不足。
解決辦法:zyx@zyx:~$ sudo chown root:root /tmp/qtopia-0 然后重啟即可。
該類型錯誤(未驗證):
(1)編譯錯誤:如果運行./qtopia.sh 后提示找不到庫文件.解決辦法:請從編譯器目錄下查找,并拷貝到開發板/mnt/yaffs/lib 中,然后重啟。
(2)編譯錯誤:can’t open framebuffer device /dev/fb0 解決辦法:執行命令:ln –sf /dev/fb/0 /dev/fb0,然后重啟。
(3)編譯錯誤:Qt/Embedded data directory is not owned by user 0:/tmp/qtembedded-0 解決辦法:執行命令:chown root:root /tmp/qtembedded-0,然后重啟。
二、因缺少類庫或安裝包不全出現編譯錯誤的解決辦法:
1.編譯錯誤:
make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src'
g++? -c -I/usr/X11R6/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/usr/X11R6/include -pipe -O2 -Wall -W -DNO_DEBUG -fPIC -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -DQT_NO_SM_SUPPORT -DQT_NO_XKB? -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/zlib -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/libpng? -I3rdparty/kernel -I3rdparty/tools -o tmp/release-shared-linux-g++/3rdparty/kernel/qmotifdnd_x11.o 3rdparty/kernel/qmotifdnd_x11.cpp
3rdparty/kernel/qmotifdnd_x11.cpp:80:22: error: X11/Xlib.h: No such file or directory
............
3rdparty/kernel/qmotifdnd_x11.cpp:902: error: ‘struct DndData’ has no member named ‘time’
make[1]: *** [tmp/release-shared-linux-g++/3rdparty/kernel/qmotifdnd_x11.o] Error 1
make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src'
原因:
缺少x11/xlib.h,安裝libx11-dev即可解決:
解決辦法:
zyx@zyx:~$?sudo apt-get install libx11-dev
2.編譯錯誤:
make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src'
g++? -c -I/usr/X11R6/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/usr/X11R6/include -pipe -O2 -Wall -W -DNO_DEBUG -fPIC -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -DQT_NO_SM_SUPPORT -DQT_NO_XKB? -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/zlib -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/libpng? -I3rdparty/kernel -I3rdparty/tools -o tmp/release-shared-linux-g++/kernel/qpsprinter.o kernel/qpsprinter.cpp
In file included from kernel/qpsprinter.cpp:97:
kernel/qt_x11.h:83:34: error: X11/extensions/shape.h: No such file or directory
In file included from kernel/qpsprinter.cpp:75:
kernel/qimage.h: In member function ‘int QImageTextKeyLang::operator<(const QImageTextKeyLang&) const’:
kernel/qimage.h:58: warning: suggest parentheses around ‘&&’ within ‘||’
make[1]: *** [tmp/release-shared-linux-g++/kernel/qpsprinter.o] Error 1
make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src'
原因:
缺少X11/extensions/shape.h,安裝x11proto-xext-dev即可解決
解決辦法:
zyx@zyx:~$?sudo apt-get install x11proto-xext-dev
3.編譯錯誤:
make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/tools/designer/uic'
g++ -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib -Wl,-rpath,/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib?? -o /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/uic uic.o ../shared/widgetdatabase.o ../shared/domtool.o ../integration/kdevelop/kdewidgets.o?? -lqt?
/usr/bin/ld: cannot find -lqt
collect2: ld returned 1 exit status
make[1]: *** [/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/uic] Error 1
make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/tools/designer/uic'
原因:缺少lqt,安裝libqt3-mt-dev即可解決
解決辦法:
zyx@zyx:~$?sudo apt-get install libqt3-mt-dev
4.編譯錯誤:
/usr/bin/ld: cannot find -lXmu
collect2: ld returned 1 exit status
make[2]: *** [../lib/libqt-mt.so.3.3.5] Error 1
make[2]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/dqt/src'
make[1]: *** [sub-src] Error 2
make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/dqt'
原因:缺少lXmu,安裝libXmu-dev即可解決
解決辦法:
zyx@zyx:~$?sudo apt-get install libXmu-dev
5.編譯錯誤:
/usr/bin/ld: cannot find -luuid
/usr/bin/ld: cannot find -lqte
collect2: ld returned 1 exit status
make[5]: *** [../../../lib/libqpe.so.1.5.3] Error 1
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
?done !
the konqueror directory is already !
原因:缺少luuid,安裝uuid-dev即可解決
解決辦法:
zyx@zyx:~$?sudo apt-get install uuid-dev
注:以下編譯錯誤解決辦法未驗證。
6.編譯錯誤:C compiler cannot create executables,
解決辦法:sudo apt-get install gcc libc6-dev
7.編譯錯誤:checking for C compiler default output... configure: error: C compiler cannot create executables
解決辦法:sudo apt-get install libc6-dev
8.編譯錯誤:configure: error: C++ preprocessor "/lib/cpp" fails sanity check
原因:gcc的組件沒裝全
解決辦法:apt-get install build-essential
9.編譯錯誤: Can't find X includes. Please check your installation and add the correct paths!
原因:沒有X的包含文件
解決辦法:安裝xlibs-dev即可
10.編譯錯誤: Qt (>= Qt 3.0) (headers and libraries) not found. Please check your installation!
原因:查找提供qt的lib&&headers的軟件包,并安裝之
解決辦法:apt-get install libqt3-headers libqt3-mt-dev
11.編譯錯誤:in the prefix, you've chosen, are no KDE headers installed. This will fail.
So, check this please and use another prefix!
which basically means its going to want to install a lot of KDE specific packages to work. This 'configure:error'
is due to it expecting you to be running KDE and again refers to some 'headers'.
原因:install a KDE application in a Gnome environment。
解決辦法:
sudo apt-get update
sudo apt-get install kdelibs4-dev kdelibs4c2a
12.編譯錯誤:./admin/cvs.sh: 585: autoconf: not found
解決辦法:apt-get install autoconf
13.編譯錯誤: *** GTK >= 2.4.0 not installed! ***
原因:沒裝GTK
解決辦法:apt-get build-dep gedit
14.編譯錯誤:heching for gtk-config... no
checking for GTK - version = 1.2.0... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG enviroment variable to the
*** full path to gtk-config.
configure: error: Cannot find GTK: Is gtk-config in path?
解決辦法:sudo apt-get install libgtk1.2-dev
15.編譯問題:eclipse中encoding不支持中文
解決辦法:編輯/var/lib/locales/supported.d/local,加一行zh_CN.GBK GBK,執行sudo locale-gen
16.編譯辦法錯誤:gnome.h: No such file or directory No package 'libpanelapplet-2.0' found
解決:sudo apt-get install gnome-panel
17.編譯問題:eva不彈出輸入法
解決辦法:sudo apt-get install scim-qtimm
18.編譯問題:
No package 'gtk+-2.0' found
No package 'gtksourceview-1.0' found
No package 'libgnomeui-2.0' found
No package 'libglade-2.0' found
No package 'libgnomeprintui-2.2' found
解決辦法:sudo apt-get install libgtk2.0-dev libgtksourceview-dev libgnomeui-dev libglade2-dev libgnomeprint2.2-dev
19.編譯問題:No package 'libpanelapplet-2.0' found
解決辦法:sudo apt-get install libpanelappletmm-2.6-dev
三、源代碼問題函數錯誤及權限不足出現編譯錯誤的解決辦法:
1.編譯錯誤:
***********************************
********* Build Qt 2 **************
***********************************
make[1]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src'
echo '#include "kernel/qt.h"' >allmoc.cpp
g++? -c -I/usr/X11R6/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/usr/X11R6/include -pipe -O2 -Wall -W -DNO_DEBUG -fPIC -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -DQT_NO_SM_SUPPORT -DQT_NO_XKB? -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/zlib -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/3rdparty/libpng? -I3rdparty/kernel -I3rdparty/tools -o tmp/release-shared-linux-g++/tools/qmemoryfile_unix.o tools/qmemoryfile_unix.cpp
tools/qmemoryfile_unix.cpp: In member function ‘QMemoryFileData* QMemoryFile::openData(const QString&, int, uint)’:
tools/qmemoryfile_unix.cpp:149: warning: format not a string literal and no format arguments
tools/qmemoryfile_unix.cpp:152: warning: format not a string literal and no format arguments
tools/qmemoryfile_unix.cpp:181: warning: format not a string literal and no format arguments
tools/qmemoryfile_unix.cpp:190: warning: format not a string literal and no format arguments
tools/qmemoryfile_unix.cpp:235: warning: format not a string literal and no format arguments
In file included from /usr/include/fcntl.h:217,
???????????????? from tools/qmemoryfile_unix.cpp:50:
In function ‘int open(const char*, int, ...)’,
??? inlined from ‘QMemoryFileData* QMemoryFile::openData(const QString&, int, uint)’ at tools/qmemoryfile_unix.cpp:143:
/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[1]: *** [tmp/release-shared-linux-g++/tools/qmemoryfile_unix.o] Error 1
make[1]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src'
原因:
在Ubuntu 10.10上, gcc會嚴格檢查open()的參數傳遞,如果第二個參數為O_CREAT的話(就像/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/src/tools/qmemoryfile_unix.cpp的143行這樣),必須傳入第三個參數mode來提供創建權限。
解決辦法:
手動修改/opt/EmbedSky/Qte/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);
2.編譯錯誤:
***********************************
********* Build Qtopia ************
***********************************
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_DA
TA_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'
原因:
在Ubuntu 10.10上, gcc會嚴格檢查open()的參數傳遞,如果第二個參數為O_CREAT的話,必須傳入第三個參數mode來提供創建權限。
解決辦法:
手動修改/opt/EmbedSky/Qte/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);?
3.編譯錯誤:
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'
原因:函數返回值類型不匹配
解決方法:
修改/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/libraries/qtopia/backend/vobject.cpp:第419行
將
?? char *dot = strrchr(g,'.');
修改為
?? char *dot = (char*)strrchr(g,'.');
4.編譯錯誤:
make[6]: Entering directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/plugins/codecs/wavplugin'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -fPIC? -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"wavplugin\" -DQTOPIA_TRTARGET=\"libwavplugin\" -DQT_NO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/mkspecs/qws/linux-generic-g++ -I. -I../../../3rdparty/libraries/gsm -I../../../../include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I.ui/release-shared/ -I.moc/release-shared/ -o .obj/release-shared/wavplugin.o wavplugin.cpp
wavplugin.cpp: In member function ‘virtual bool WavPlugin::isFileSupported(const QString&)’:
wavplugin.cpp:435: error: invalid conversion from ‘const char*’ to ‘char*’
make[6]: *** [.obj/release-shared/wavplugin.o] Error 1
make[6]: Leaving directory `/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/plugins/codecs/wavplugin'
原因:函數返回值類型不匹配
解決方法:
修改/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/src/plugins/codecs/wavplugin/wavplugin.cpp:第435行
將
??? char *ext = strrchr( path.latin1(), '.' );
修改為
??? char *ext = (char*)strrchr( path.latin1(), '.' );
5.編譯錯誤(此為arm編譯腳本運行時出現的錯誤):
In function ‘open’,
??? inlined from ‘main’ at ts_calibrate.c:230:
/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
In function ‘open’,
??? inlined from ‘main’ at ts_calibrate.c:232:
/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 10.10上, gcc會嚴格檢查open()的參數傳遞,如果第二個參數為O_CREAT的話,必須傳入第三個參數mode來提供創建權限。
解決方法:
確定ts_calibrate.c的位置:
root@zyx:/opt/EmbedSky/Qte# locate ts_calibrate.c
/opt/EmbedSky/Qte/arm-qtopia-2.2.0/tslib-1.4.1/tests/ts_calibrate.c
修改/opt/EmbedSky/Qte/arm-qtopia-2.2.0/tslib-1.4.1/tests/ts_calibrate.c:第230行
將
?? cal_fd = open (calfile, O_CREAT | O_RDWR);
修改為
?? cal_fd = open (calfile, O_CREAT | O_RDWR,0666);
修改/opt/EmbedSky/Qte/arm-qtopia-2.2.0/tslib-1.4.1/tests/ts_calibrate.c:第232行
將
?? cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);
修改為
?? cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR,0666);
總結
以上是生活随笔為你收集整理的ubuntu10.10编译qtopia-2.2.0 问题总结及分析的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在 ubuntu 上编译 qtopia-
- 下一篇: ubuntu 10.04源 更新源列表