更換Qt QtEmbedded庫的版本出現問題及解決(交叉編譯OpenSSL)


近日將QtEmbedded庫的版本由4.7.0更新到4.7.4.工具鏈並未改變,仍為

Target: arm-none-linux-gnueabi
Configured with: ......
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)


所有依賴的庫根據需要重新下載最新版本編譯。現將在此過程中出現的問題及解決方法列出,以供下次移植時參考。

 

1.browser程序重新編譯,在開發板的命令行運行:
./browser -display "LinuxFB:/dev/fb1" -geometry 1920x1080 -qws
 www.baidu.com &

 

a.第1次錯誤
-----------------------------------------------------------------------------
./browser: error while loading shared libraries: libqtsingleapplication.so.1: cannot open shared object file: No such file or directory
-----------------------------------------------------------------------------

拷貝libqtsingleapplication.so.1庫到/nand1/lib中消除了這個問題

 

b.第2次錯誤
-----------------------------------------------------------------------------
 QFontDatabase: Cannot find font directory /usr/local/arm/qte4.7.4/lib/fonts - is Qt installed correctly?
-----------------------------------------------------------------------------

在目錄/nand1/allapp/browser下建立qt.conf文件,文件內容
-----------------------------------------------------------------------------
[Paths]
Prefix = /usr/qte-4.7.4
Translations = share/qtopia/translations
Plugins = lib/qtopia/plugins
Libraries = lib
#Headers = include/qtopia
-----------------------------------------------------------------------------

頁在/usr/qte-4.7.4下只是建立到nand1相應目錄的鏈接,
------------------------------------------------------------------------------
/usr/qte-4.7.4 # ls -l
lrwxrwxrwx    1 root     0              10 Jan  1  1970 etc -> /nand1/etc
lrwxrwxrwx    1 root     0              10 Jan  1  1970 lib -> /nand1/lib
lrwxrwxrwx    1 root     0              14 Jan  1  1970 libexec -> /nand1/libexec
lrwxrwxrwx    1 root     0              11 Jan  1  1970 sbin -> /nand1/sbin
lrwxrwxrwx    1 root     0              12 Jan  1  1970 share -> /nand1/share
lrwxrwxrwx    1 root     0              10 Jan  1  1970 ssl -> /nand1/ssl
lrwxrwxrwx    1 root     0              19 Jan  1  1970 translations -> /nand1/translations
lrwxrwxrwx    1 root     0              10 Jan  1  1970 var -> /nand1/var
------------------------------------------------------------------------------

 

c.第3次錯誤
------------------------------------------------------------------------------
/nand1/allapp/browser # LinuxFB: driver not found
------------------------------------------------------------------------------
在編譯QtEmbedded時的配置參數是:


./configure -opensource -confirm-license -release \
-prefix /usr/local/arm/qte4.7.4 \
-webkit -qt-zlib \
-xplatform qws/linux-arm-gnueabi-g++ -embedded armv6 \
-qt-kbd-linuxinput -qt-mouse-linuxinput -plugin-gfx-linuxfb \
-nomake demos -nomake examples -nomake tools -nomake test -fast \
-L /usr/local/arm/lib -I /usr/local/arm/include

 

增加上-qt-gfx-linuxfb,去除-plugin-gfx-linuxfb


=================================================================================
./configure -opensource -confirm-license -release \
-prefix /usr/local/arm/qte4.7.4 \
-webkit -qt-zlib \
-xplatform qws/linux-arm-gnueabi-g++ -embedded armv6 \
-qt-kbd-linuxinput -qt-mouse-linuxinput -qt-gfx-linuxfb \
-nomake demos -nomake examples -nomake tools -nomake test -fast \
-L /usr/local/arm/lib -I /usr/local/arm/include
=================================================================================

對與LinuxFb相關的配置項

----------------------------------------------------------------------------------
-qt-gfx-<driver> … Enable a graphics <driver> in the QtGui library.
Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen ]

-plugin-gfx-<driver> Enable graphics <driver> as a plugin to be
linked to at run time.
Possible values for <driver>: [  ahi directfb hybrid linuxfb powervr qvfb transformed vnc ]

-no-gfx-<driver> … Disable graphics <driver> entirely.
Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen ]

-----------------------------------------------------------------------------------

再次編譯QtEmbedded時的信息:

-----------------------------------------------------------------------------------

Building on:   qws/linux-x86-g++
Building for:  qws/linux-arm-gnueabi-g++
Architecture:  armv6
Host architecture: i386

Build .................. libs docs translations
Configuration ..........  cross_compile release shared dll embedded largefile stl precompile_header exceptions_off  minimal-config small-config medium-config large-config full-config qt3support accessibility embedded reduce_exports ipv6 clock-gettime clock-monotonic mremap getaddrinfo ipv6ifname getifaddrs inotify png freetype zlib nis multimedia audio-backend svg script scripttools declarative release
Debug .................. no
Qt 3 compatibility ..... yes
QtDBus module .......... no
QtConcurrent code ...... yes
QtGui module ........... yes
QtScript module ........ yes
QtScriptTools module ... yes
QtXmlPatterns module ... no
Phonon module .......... no
Multimedia module ...... auto
SVG module ............. yes
WebKit module .......... yes
JavaScriptCore JIT ..... To be decided by JavaScriptCore
Declarative module ..... yes
Declarative debugging ...yes
Support for S60 ........ no
Symbian DEF files ...... no
STL support ............ yes
PCH support ............ yes
MMX/3DNOW/SSE/SSE2/SSE3. no/no/no/no/no
SSSE3/SSE4.1/SSE4.2..... no/no/no
AVX..................... no
iWMMXt support ......... no
NEON support ........... no
IPv6 support ........... yes
IPv6 ifname support .... yes
getaddrinfo support .... yes
getifaddrs support ..... yes
Accessibility .......... yes
NIS support ............ yes
CUPS support ........... no
Iconv support .......... no
Glib support ........... no
GStreamer support ...... no
PulseAudio support ..... no
Large File support ..... yes
GIF support ............ plugin
TIFF support ........... plugin (qt)
JPEG support ........... plugin (qt)
PNG support ............ yes (qt)
MNG support ............ plugin (qt)
zlib support ........... yes
Session management ..... no
Embedded support ....... armv6
Freetype2 support ...... auto (yes)
Graphics (qt) .......... linuxfb multiscreen linuxfb
Graphics (plugin) ......
Decorations (qt) ....... styled windows default
Decorations (plugin) ...
Keyboard driver (qt) ... tty linuxinput
Keyboard driver (plugin) ..
Mouse driver (qt) ...... pc linuxtp linuxinput
Mouse driver (plugin) ..
OpenGL support ......... no
OpenVG support ......... no
SQLite support ......... plugin (qt)
OpenSSL support ........ no
Alsa support ........... no
ICD support ............ no

-----------------------------------------------------------------------------------

 

d.第4次錯誤
再次運行,這次不再報inuxFB: driver not found.上次的問題得到解決
但由於缺必需的libweboxj.so,需要編譯weboxjlib工程,生成so文件

$qmake weboxjlib.pro -r -spec /usr/local/arm/qte4.7.4/mkspecs/qws/linux-arm-gnueabi-g++
$make
出現下面錯誤:
---------------------------------------------------------------------------------
bookmarksdrv.h:8:27: error: libxml/parser.h: No such file or directory
bookmarksdrv.h:9:26: error: libxml/xpath.h: No such file or directory
In file included from weboxjlib.cpp:14:
----------------------------------------------------------------------------------

從信息中可看出,需要交叉編譯libxml2庫
我編譯的版本是libxml2-2.7.8.tar.gz,交叉編譯支持很好,只要在configure時設置正確的--host就搞定了
交叉編譯安裝后,問題解決,當然要修改weboxjlib.pro文件中的INCLUDEPATH路徑,添加安裝的libxml2的頭文件路徑

 

e.第5次錯誤
---------------------------------------------------------------------------------
mycurl.cpp:4:24: error: curl/multi.h: No such file or directory
mycurl.cpp: In member function 'void DownloadThread::init_easy_curl(CURLM*, my_curl_quest*)':
mycurl.cpp:33: error: 'CURL' was not declared in this scope
---------------------------------------------------------------------------------
這次是Curl庫未交叉編譯過,
下載curl-7.22.0.tar.bz2源碼包進行交叉編譯並安裝

 

f.第6次錯誤
---------------------------------------------------------------------------------
des3drv.cpp:3:25: error: openssl/des.h: No such file or directory
des3drv.cpp: In member function 'void Des3Drv::Des3Encrypt(const QString&, const QString&, QString&)':
des3drv.cpp:103: error: 'DES_key_schedule' was not declared in this scope
---------------------------------------------------------------------------------
是openssl庫未交叉編譯
下載openssl-1.0.0e.tar.gz源碼包
openssl對交叉編譯支持不好,需要confiugre后修改Makefile文件

---------------------------------------------------------------------------------
CC= arm-none-linux-gnueabi-gcc
CFLAG= -DOPENSSL_THREADS  -Wa,--noexecstack
DEPFLAG= -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_STORE
PEX_LIBS=
EX_LIBS=
EXE_EXT=
ARFLAGS=
AR= arm-none-linux-gnueabi-ar $(ARFLAGS) r
RANLIB= arm-none-linux-gnueabi-ranlib
NM= arm-none-linux-gnueabi-nm
PERL= /usr/bin/perl
TAR= tar
TARFLAGS= --no-recursion
MAKEDEPPROG=makedepend
LIBDIR=lib

---------------------------------------------------------------------------------
上面紅色的部分是修改過的,應根據交叉編譯器來設置。后面的make、make install沒有什么問題.


g.第7次錯誤
----------------------------------------------------------------------------------
/usr/local/arm/arm-2008q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lbcti_telechips
collect2: ld returned 1 exit status
make: *** [libweboxjlib.so.1.0.0] 錯誤
----------------------------------------------------------------------------------
這個庫是百視通提供的第三方庫,將其拷貝到當前目錄下就可以了

 

h.第8次錯誤
現在browser程序終於可以運行了,但是在加載libweboxj庫時會拋出錯誤,主要是libweboxj庫本身依賴的庫在板子上不存在.
使用strace工具會有以下信息:
----------------------------------------------------------------------------------
open("/usr/lib/fast-mult/half/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/fast-mult/half", 0xbec470f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/fast-mult/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/fast-mult", 0xbec470f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/half/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/half", 0xbec470f0)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
munmap(0x45880000, 501536)              = 0
munmap(0x458fb000, 286544)              = 0
munmap(0x45941000, 349680)              = 0
stat64("/nand1/allapp/webox/libweboxjlib.so", {st_mode=S_IFREG|0755, st_size=471392, ...}) = 0
write(2, "terminate called after throwing "..., 48terminate called after throwing an instance of ') = 48
write(2, "JsHostMng::ExceptId", 19JsHostMng::ExceptId)     = 19
write(2, "'\n", 2'
)                      = 2
----------------------------------------------------------------------------------
從以上信息看出是libxml2庫找不到,交叉編譯libxml2庫后下載到板子上即可。


i.第9個錯誤
現在程序可以運行起來了,但是發現在瀏覽網頁時gif圖片顯示不出來
看來是qt的插件imageformats未編譯安裝到開發板
進入qte4.7.4的源碼目錄./qte-4.7.4/src/plugins/imageformats中,運行下面命令
qmake
make clean
make
make install
將安裝目錄./plugins/imageformats中的庫文件拷貝到開發板中,並在qt.conf中設置正確的插件路徑,我的qt.conf設置如下:
-----------------------------------------------------------------------------------
[Paths]
Prefix = /usr/qte-4.7.4
Translations = share/qtopia/translations
Plugins = lib/qtopia/plugins
Libraries = lib
#Headers = include/qtopia
------------------------------------------------------------------------------------

現在,程序應該可以正常地運行了。

總結整個的問題解決過程,qt的編譯的配置比較關鍵,一定要配置成你希望的display模式,在我的開發板上配置的是LinuxFB,具體的配置項是-qt-gfx-linuxfb。如果要支持網頁游覽,一定要加上-webkit選項,imageformats插件的編譯可以在后面單獨進行。

其它的主要是一些依賴的庫了,這和具體的應用相關。

 

http://blog.sina.com.cn/s/blog_8738908f0100ugsr.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM