程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> linux(debian) arm-linux-g++ v4.5.1交叉編譯 embedded arm 版本的QtWebkit (browser) 使用qt 4.8.6 版本,交叉編譯

linux(debian) arm-linux-g++ v4.5.1交叉編譯 embedded arm 版本的QtWebkit (browser) 使用qt 4.8.6 版本,交叉編譯

編輯:C++入門知識

linux(debian) arm-linux-g++ v4.5.1交叉編譯 embedded arm 版本的QtWebkit (browser) 使用qt 4.8.6 版本,交叉編譯


 

最近需要做一個項目 在arm 架構的linux下 沒有桌面環境的情況下拉起 有界面的浏覽器使用.

考慮用qt 的界面和 qtwebikt 的庫去實現這一系列操作.

 

本文參考:

Qt移植到ARM Linux教程:http://www.veryarm.com/930.html

成功移植qt軟鍵盤和輸入法到arm開發板的qt程序中:http://www.csdn1 2 3.com/html/mycsdn20140110/d1/d1ecf8c322c9447b049f2a71d12f5e87.html

請把上面1 2 3 換成123

 

關於鼠標不能通用 .

http://blog.chinaunix.net/uid-22666248-id-226373.html

http://wenku.baidu.com/link?url=xmdOvKLdA8W91VQqlNSyYmAw6PsKc6jV5w2mVh6y6lqSgiXbTztGx1P8ewMOAX8vF3JxOGNXseSBRjlQB3N7eBJtfZXYqv7F5vroZwr7TsO

目錄:

 

存在問題鼠標不能操作(後面發現鼠標存在,只是顏色透明,且移動飛快...),鍵盤 沒有中文輸入法 .後續待解決

 

1,前言

引用

Qt 4.8.6 X11、embeded x86(qvfb運行 )、embeded arm各個版本編譯總結

的話:

QT是跨平台C++圖形用戶界面應用程序開發框架,可以實現一套源碼,多個平台編譯運行。可視為平台無關的開發環境。

QT源碼可以被編譯成很多個版本,這裡介紹3個版本:linux桌面版(X11),embeded x86版,embeded arm版。編譯後生成對應平台庫文件,使用某平台的編譯器編譯應用程序時就會鏈接對應平台的庫文件,這樣應用程序就能在該平台下運行。

1、X11版(默認版本)
X11版本的QT可以在使用X windows系統的linux 桌面操作系統上運行(我用的是Ubuntu),如果不需要開發桌面應用程序,可以不編譯。

2、Embeded x86版
這個版本為什麼是嵌入版(Embeded)的,因為x86台式機本身也可以當做一個嵌入式系統,但是Embeded x86版的QT不能直接通過X11窗口系統輸出畫面,這時我們可以借助X11的qvfb工具仿真一個LCD輸出設備(QWS環境),這樣Embeded x86應用程序就能在Ubuntu裡仿真運行了。要理解這點其實很簡單,以Ubuntu為例,Ubuntu的應用程序是以X11協議(X窗口系統)輸送到屏幕顯示界面的,X server負責圖形顯示,應用程序負責計算、修改數據,兩者基於某種協議通信。對於嵌入式linux,qt應用程序也需要一個窗口系統才能顯示,但是嵌入式linux系統不能使用X11(太耗資源了),奇趣公司就專門開發了一個qws(QT windows system), 應用程序按照協議向qws發送數據,服務端負責顯示數據。現在,qvfb就是QWS的顯示設備。
另外請注意,Embeded x86版的QT應用程序是不能在arm開發板上運行的。
embeded x86版並不是我們的開發板最終使用的QT庫,編譯這個版本只是為了方便我們調試, 先在ubuntu中仿真運行,看看界面,不必下載到開發板的文件系統中運行,兩者的運行效果除了界面基本相同,其他方面還是有差異的。

3、Embeded arm版
這個版本才是我們在arm開發板上運行的版本。

我們做嵌入式開發,其實只需編譯第3版本的QT(Embeded arm版),編譯X11 版本的目的只是方便我個人學習QT,編譯Embeded x86只是為了體驗仿真效果。

  

但是嵌入式linux系統不能使用X11(太耗資源了),奇趣公司就專門開發了一個qws(QT windows system), 應用程序按照協議向qws發送數據,服務端負責顯示數據。現在,qvfb就是QWS的顯示設備。

 

所以後面才有了 ./qtwebkitdemo  -qws  的方式運行.

   

 

2,下載tslib和qt

  Tslib是一個開源的程序,能夠為觸摸屏驅動獲得的采樣提供諸如濾波、去抖、校准等功能,通常作為觸摸屏驅動的適配層,為上層的應用提供了一個統一的接口。

  在采用觸摸屏的移動終端中,觸摸屏性能的調試是個重要問題之一,因為電磁噪聲的緣故,觸摸屏容易存在點擊不准確、有抖動等問題。

  到 github 下載 tslib最新版,地址:https://github.com/kergoth/tslib,下載後文件名為:tslib-master.zip。

 

 

  到 Qt 官網下載合適的 Qt 版本,地址:http://download.qt-project.org/archive/qt/。本教程以 4.8.6為例,下載的壓縮包名稱為: qt-everywhere-opensource-src-4.8.6.tar.gz。

   

  之所以用qt 4.8.6這個穩定版本是因為 用qt  5.5.0 會報

pragma GCC diagnostic 這個錯.

  後面發現是gcc 版本低於4.6 .

  

../../include/QtBluetooth/../../src/bluetooth/qbluetoothdevicediscoveryagent.h:49:16: warning: expected [error|warning|ignored] after '#pragma GCC diagnostic'

qbluetoothuuid.cpp:590:1: error: #pragma GCC diagnostic not allowed inside functions
qbluetoothuuid.cpp:591:1: error: #pragma GCC diagnostic not allowed inside functions
qbluetoothuuid.cpp:592:79: warning: dereferencing type-punned pointer will break strict-aliasing rules
qbluetoothuuid.cpp:593:79: warning: dereferencing type-punned pointer will break strict-aliasing rules
qbluetoothuuid.cpp:594:79: warning: dereferencing type-punned pointer will break strict-aliasing rules
qbluetoothuuid.cpp:595:1: error: #pragma GCC diagnostic not allowed inside functions

 

 

  

 

3,交叉編譯器機所在linux的環境准備

 

sudo apt-get install automake autoconf libtool m4
sudo apt-get install libX11-dev libXext-dev libXtst-dev libXrender-dev 

  

  安裝交叉編譯器

  本文全用 arm-linux-g++ v4.5.1 

  安裝方法,參考:

  arm-linux-gcc-4.5.1的安裝方法:http://blog.sina.com.cn/s/blog_68f3489201014a86.html

  Ubuntu 13.4 安裝Arm-linux-gcc 詳細過程:http://lieyan.lofter.com/post/225d54_afc506

 

root@debian:/disk2# arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/usr/arm-linux-g++_4.5.1/4.5.1/bin/../libexec/gcc/arm-none-linux-gnueabi/4.5.1/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /work/toolchain/build/src/gcc-4.5.1/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.5.1 --with-sysroot=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --enable-languages=c,c++ --disable-multilib --with-cpu=arm1176jzf-s --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=softfp --with-pkgversion=ctng-1.8.1-FA --with-bugurl=http://www.arm9.net/ --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-gmp=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpfr=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-ppl=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-cloog=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-mpc=/work/toolchain/build/arm-none-linux-gnueabi/build/static --with-libelf=/work/toolchain/build/arm-none-linux-gnueabi/build/static --enable-threads=posix --with-local-prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root --disable-nls --enable-symvers=gnu --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.5.1 (ctng-1.8.1-FA) 
root@debian:/disk2# 

  

 

4, 編譯tslib

  

unzip tslib-master.zip
cd tslib-master

./autogen.sh
$ ./configure CC=arm-linux-gcc CXX=arm-linux-g++ --host=arm-none-linux-gnueabi --prefix=/usr/local/tslib ac_cv_func_malloc_0_nonnull=yes

make
sudo make install

  

完成後,tslib會按安裝到主機 /usr/local/tslib 目錄下。
進入下一步之前,先將主機中 /usr/local/tslib/etc/ts.conf 文件第二行“#module_raw input”的注釋去掉,變為“module_raw input”,注意一定要頂格。

  

5,編譯安裝qt

  難啃的骨頭終於開始了. !!!

  

tar xjvf qt-everywhere-opensource-src-4.8.6.tar.bz2
cd qt-everywhere-opensource-src-4.8.6

  

  打開 qt-everywhere-opensource-src-4.8.6\mkspecs\qws\linux-arm-g++ 目錄下的 qmake.conf (請先備份)  

  注:

  關於qws 之前一直不明所以....

  還記得文章開頭的

 

  "

但是嵌入式linux系統不能使用X11(太耗資源了),奇趣公司就專門開發了一個qws(QT windows system), 應用程序按照協議向qws發送數據,服務端負責顯示數據。現在,qvfb就是QWS的顯示設備。

 

所以後面才有了 ./qtwebkitdemo  -qws  的方式運行.

"

所以,,恍然大W...

 

 

原內容:

#
# qmake configuration for building with arm-linux-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gcc
QMAKE_CXX               = arm-linux-g++
QMAKE_LINK              = arm-linux-g++
QMAKE_LINK_SHLIB        = arm-linux-g++

# modifications to linux.conf
QMAKE_AR                = arm-linux-ar cqs
QMAKE_OBJCOPY           = arm-linux-objcopy
QMAKE_STRIP             = arm-linux-strip

load(qt_config)

 

 

  改成

#
# qmake configuration for building with arm-linux-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = /usr/arm-linux-g++_4.5.1/4.5.1/bin/arm-linux-gcc -lts
QMAKE_CXX               = /usr/arm-linux-g++_4.5.1/4.5.1/bin/arm-linux-g++ -lts
QMAKE_LINK              = /usr/arm-linux-g++_4.5.1/4.5.1/bin/arm-linux-g++ -lts
QMAKE_LINK_SHLIB        = /usr/arm-linux-g++_4.5.1/4.5.1/bin/arm-linux-g++ -lts

# modifications to linux.conf
QMAKE_AR                = /usr/arm-linux-g++_4.5.1/4.5.1/bin/arm-linux-ar cqs
QMAKE_OBJCOPY           = /usr/arm-linux-g++_4.5.1/4.5.1/bin/arm-linux-objcopy
QMAKE_STRIP             = /usr/arm-linux-g++_4.5.1/4.5.1/bin/arm-linux-strip

load(qt_config)

  為防止找不到路徑,所以直接全路徑了.  簡單粗暴.

 

  再來看看

  ./configure --help

 

  

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6# ./configure --help
Usage:  configure [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
        [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
        [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>]
        [-demosdir <dir>] [-buildkey <key>] [-release] [-debug]
        [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
        [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
        [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
        [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
        [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
        [-qt-zlib] [-system-zlib] [-no-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
        [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
        [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
        [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
        [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
        [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
        [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
        [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon]
        [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
        [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
        [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
        [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] 
        [-no-openssl] [-openssl] [-openssl-linked]
        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-webkit-debug]
        [-no-javascript-jit] [-javascript-jit]
        [-no-script] [-script] [-no-scripttools] [-scripttools] 
        [-no-declarative] [-declarative] [-no-declarative-debug] [-declarative-debug]
        [additional platform specific options (see below)]


Installation options:

    -qpa [name] ......... This will enable the QPA build.
                          QPA is a window system agnostic implementation of Qt.
                          If [name] is given, sets the default QPA platform (e.g xcb, cocoa).

 These are optional, but you may specify install directories.

    -prefix <dir> ...... This will install everything relative to <dir>
                         (default /usr/local/Trolltech/Qt-4.8.6)

  * -prefix-install .... Force a sandboxed "local" installation of
                         Qt. This will install into
                         /usr/local/Trolltech/Qt-4.8.6, if this option is
                         disabled then some platforms will attempt a
                         "system" install by placing default values
                         in a system location other than PREFIX.

 You may use these to separate different parts of the install:

    -bindir <dir> ......... Executables will be installed to <dir>
                            (default PREFIX/bin)
    -libdir <dir> ......... Libraries will be installed to <dir>
                            (default PREFIX/lib)
    -docdir <dir> ......... Documentation will be installed to <dir>
                            (default PREFIX/doc)
    -headerdir <dir> ...... Headers will be installed to <dir>
                            (default PREFIX/include)
    -plugindir <dir> ...... Plugins will be installed to <dir>
                            (default PREFIX/plugins)
    -importdir <dir> ...... Imports for QML will be installed to <dir>
                            (default PREFIX/imports)
    -datadir <dir> ........ Data used by Qt programs will be installed to <dir>
                            (default PREFIX)
    -translationdir <dir> . Translations of Qt programs will be installed to <dir>
                            (default PREFIX/translations)
    -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
                            (default PREFIX/etc/settings)
    -examplesdir <dir> .... Examples will be installed to <dir>
                            (default PREFIX/examples)
    -demosdir <dir> ....... Demos will be installed to <dir>
                            (default PREFIX/demos)

 You may use these options to turn on strict plugin loading.

    -buildkey <key> .... Build the Qt library and plugins using the specified
                         <key>.  When the library loads plugins, it will only
                         load those that have a matching key.

Configure options:

 The defaults (*) are usually acceptable. A plus (+) denotes a default value
 that needs to be evaluated. If the evaluation succeeds, the feature is
 included. Here is a short explanation of each option:

 *  -release ........... Compile and link Qt with debugging turned off.
    -debug ............. Compile and link Qt with debugging turned on.
    -debug-and-release . Compile and link two versions of Qt, with and without
                         debugging turned on (Mac only).

    -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)

    -opensource ........ Compile and link the Open-Source Edition of Qt.
    -commercial ........ Compile and link the Commercial Edition of Qt.


 *  -shared ............ Create and use shared Qt libraries.
    -static ............ Create and use static Qt libraries.

 *  -no-fast ........... Configure Qt normally by generating Makefiles for all
                         project files.
    -fast .............. Configure Qt quickly by generating Makefiles only for
                         library and subdirectory targets.  All other Makefiles
                         are created as wrappers, which will in turn run qmake.

    -no-largefile ...... Disables large file support.
 +  -largefile ......... Enables Qt to access files larger than 4 GB.

 *  -no-system-proxies . Do not use system network proxies by default.
    -system-proxies .... Use system network proxies by default.

    -no-exceptions ..... Disable exceptions on compilers that support it.
 *  -exceptions ........ Enable exceptions on compilers that support it.

    -no-accessibility .. Do not compile Accessibility support.
 *  -accessibility ..... Compile Accessibility support.

    -no-stl ............ Do not compile STL support.
 *  -stl ............... Compile STL support.

    -no-sql-<driver> ... Disable SQL <driver> entirely.
    -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
                         none are turned on.
    -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
                         at run time.

                         Possible values for <driver>:
                         [  db2 ibase mysql oci odbc psql sqlite sqlite2 sqlite_symbian symsql tds ]

    -system-sqlite ..... Use sqlite from the operating system.

    -no-qt3support ..... Disables the Qt 3 support functionality.
 *  -qt3support ........ Enables the Qt 3 support functionality.

    -no-xmlpatterns .... Do not build the QtXmlPatterns module.
 +  -xmlpatterns ....... Build the QtXmlPatterns module.
                         QtXmlPatterns is built if a decent C++ compiler
                         is used and exceptions are enabled.

    -no-multimedia ..... Do not build the QtMultimedia module.
 +  -multimedia ........ Build the QtMultimedia module.

    -no-audio-backend .. Do not build the platform audio backend into QtMultimedia.
 +  -audio-backend ..... Build the platform audio backend into QtMultimedia if available.

    -no-phonon ......... Do not build the Phonon module.
 +  -phonon ............ Build the Phonon module.
                         Phonon is built if a decent C++ compiler is used.
    -no-phonon-backend.. Do not build the platform phonon plugin.
 +  -phonon-backend..... Build the platform phonon plugin.

    -no-svg ............ Do not build the SVG module.
 +  -svg ............... Build the SVG module.

    -no-webkit ......... Do not build the WebKit module.
 +  -webkit ............ Build the WebKit module.
                         WebKit is built if a decent C++ compiler is used.
    -webkit-debug ...... Build the WebKit module with debug symbols.

    -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
 +  -javascript-jit .... Build the JavaScriptCore JIT compiler.

    -no-script ......... Do not build the QtScript module.
 +  -script ............ Build the QtScript module.

    -no-scripttools .... Do not build the QtScriptTools module.
 +  -scripttools ....... Build the QtScriptTools module.

    -no-declarative ..... Do not build the declarative module.
 +  -declarative ....... Build the declarative module.

    -no-declarative-debug ..... Do not build the declarative debugging support.
 +  -declarative-debug ....... Build the declarative debugging support.

    -platform target ... The operating system and compiler you are building
                         on (linux-g++).

                         See the README file for a list of supported
                         operating systems and compilers.
    -graphicssystem <sys> Sets an alternate graphics system. Available options are:
                           raster - Software rasterizer
                           opengl - Rendering via OpenGL, Experimental!
                           openvg - Rendering via OpenVG, Experimental!


    -no-mmx ............ Do not compile with use of MMX instructions.
    -no-3dnow .......... Do not compile with use of 3DNOW instructions.
    -no-sse ............ Do not compile with use of SSE instructions.
    -no-sse2 ........... Do not compile with use of SSE2 instructions.
    -no-sse3 ........... Do not compile with use of SSE3 instructions.
    -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
    -no-sse4.1.......... Do not compile with use of SSE4.1 instructions.
    -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
    -no-avx ............ Do not compile with use of AVX instructions.
    -no-neon ........... Do not compile with use of NEON instructions.

    -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
    -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.

    -D <string> ........ Add an explicit define to the preprocessor.
    -I <string> ........ Add an explicit include path.
    -L <string> ........ Add an explicit library path.

    -help, -h .......... Display this information.

Third Party Libraries:

    -qt-zlib ........... Use the zlib bundled with Qt.
 +  -system-zlib ....... Use zlib from the operating system.
                         See http://www.gzip.org/zlib

    -no-gif ............ Do not compile GIF reading support.

    -no-libtiff ........ Do not compile TIFF support.
    -qt-libtiff ........ Use the libtiff bundled with Qt.
 +  -system-libtiff .... Use libtiff from the operating system.
                         See http://www.libtiff.org

    -no-libpng ......... Do not compile PNG support.
    -qt-libpng ......... Use the libpng bundled with Qt.
 +  -system-libpng ..... Use libpng from the operating system.
                         See http://www.libpng.org/pub/png

    -no-libmng ......... Do not compile MNG support.
    -qt-libmng ......... Use the libmng bundled with Qt.
 +  -system-libmng ..... Use libmng from the operating system.
                         See http://www.libmng.com

    -no-libjpeg ........ Do not compile JPEG support.
    -qt-libjpeg ........ Use the libjpeg bundled with Qt.
 +  -system-libjpeg .... Use libjpeg from the operating system.
                         See http://www.ijg.org

    -no-openssl ........ Do not compile support for OpenSSL.
 +  -openssl ........... Enable run-time OpenSSL support.
    -openssl-linked .... Enabled linked OpenSSL support.

    -ptmalloc .......... Override the system memory allocator with ptmalloc.
                         (Experimental.)

Additional options:

    -make <part> ....... Add part to the list of parts to be built at make time.
                         (libs tools examples demos docs translations)
    -nomake <part> ..... Exclude part from the list of parts to be built.

    -R <string> ........ Add an explicit runtime library path to the Qt
                         libraries.
    -l <string> ........ Add an explicit library.

    -no-rpath .......... Do not use the library install path as a runtime
                         library path.
 +  -rpath ............. Link Qt libraries and executables using the library
                         install path as a runtime library path. Equivalent
                         to -R install_libpath

    -continue .......... Continue as far as possible if an error occurs.

    -verbose, -v ....... Print verbose information about each step of the
                         configure process.

    -silent ............ Reduce the build output so that warnings and errors
                         can be seen more easily.

 *  -no-optimized-qmake ... Do not build qmake optimized.
    -optimized-qmake ...... Build qmake optimized.

    -no-gui ............ Don't build the Qt GUI library

    -no-nis ............ Do not compile NIS support.
 *  -nis ............... Compile NIS support.

    -no-cups ........... Do not compile CUPS support.
 *  -cups .............. Compile CUPS support.
                         Requires cups/cups.h and libcups.so.2.

    -no-iconv .......... Do not compile support for iconv(3).
 *  -iconv ............. Compile support for iconv(3).

    -no-pch ............ Do not use precompiled header support.
 *  -pch ............... Use precompiled header support.

    -no-dbus ........... Do not compile the QtDBus module.
 +  -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
    -dbus-linked ....... Compile the QtDBus module and link to libdbus-1.

    -reduce-relocations ..... Reduce relocations in the libraries through extra
                              linker optimizations (Qt/X11 and Qt for Embedded Linux only;
                              experimental; needs GNU ld >= 2.18).

 *  -no-separate-debug-info . Do not store debug information in a separate file.
    -separate-debug-info .... Strip debug information into a separate file.


Qt/X11 only:

    -no-gtkstyle ....... Do not build the GTK theme integration.
 +  -gtkstyle .......... Build the GTK theme integration.

 *  -no-nas-sound ...... Do not compile in NAS sound support.
    -system-nas-sound .. Use NAS libaudio from the operating system.
                         See http://radscan.com/nas.html

    -egl ............... Use EGL instead of GLX to manage contexts.
                         When building for desktop OpenGL, this option will
                         make Qt use EGL to manage contexts rather than the
                         GLX, which is the default. Note: For OpenGL ES, EGL
                         is always used.

    -no-opengl ......... Do not support OpenGL.
 +  -opengl <api> ...... Enable OpenGL support.
                         With no parameter, this will auto-detect the "best"
                         OpenGL API to use. If desktop OpenGL is available, it
                         will be used. Use desktop, es1, or es2 for <api>
                         to force the use of the Desktop (OpenGL 1.x or 2.x),
                         OpenGL ES 1.x Common profile, or 2.x APIs instead.

     -no-openvg ........ Do not support OpenVG.
 +   -openvg ........... Enable OpenVG support.
                         Requires EGL support, typically supplied by an OpenGL
                         or other graphics implementation.

    -no-sm ............. Do not support X Session Management.
 *  -sm ................ Support X Session Management, links in -lSM -lICE.

    -no-xshape ......... Do not compile XShape support.
 *  -xshape ............ Compile XShape support.
                         Requires X11/extensions/shape.h.

    -no-xvideo ......... Do not compile XVideo support.
 *  -xvideo ............ Compile XVideo support.
                         Requires X11/extensions/Xv.h & Xvlib.h.

    -no-xsync .......... Do not compile XSync support.
 *  -xsync ............. Compile XSync support.
                         Requires X11/extensions/sync.h.

    -no-xinerama ....... Do not compile Xinerama (multihead) support.
 *  -xinerama .......... Compile Xinerama support.
                         Requires X11/extensions/Xinerama.h and libXinerama.
                         By default, Xinerama support will be compiled if
                         available and the shared libraries are dynamically
                         loaded at runtime.

    -no-xcursor ........ Do not compile Xcursor support.
 *  -xcursor ........... Compile Xcursor support.
                         Requires X11/Xcursor/Xcursor.h and libXcursor.
                         By default, Xcursor support will be compiled if
                         available and the shared libraries are dynamically
                         loaded at runtime.

    -no-xfixes ......... Do not compile Xfixes support.
 *  -xfixes ............ Compile Xfixes support.
                         Requires X11/extensions/Xfixes.h and libXfixes.
                         By default, Xfixes support will be compiled if
                         available and the shared libraries are dynamically
                         loaded at runtime.

    -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
 *  -xrandr ............ Compile Xrandr support.
                         Requires X11/extensions/Xrandr.h and libXrandr.

    -no-xrender ........ Do not compile Xrender support.
 *  -xrender ........... Compile Xrender support.
                         Requires X11/extensions/Xrender.h and libXrender.

    -no-mitshm ......... Do not compile MIT-SHM support.
 *  -mitshm ............ Compile MIT-SHM support.
                         Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h

    -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
 *  -fontconfig ........ Compile FontConfig support.
                         Requires fontconfig/fontconfig.h, libfontconfig,
                         freetype.h and libfreetype.

    -no-xinput ......... Do not compile Xinput support.
 *  -xinput ............ Compile Xinput support. This also enabled tablet support
                         which requires IRIX with wacom.h and libXi or
                         XFree86 with X11/extensions/XInput.h and libXi.

    -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
 *  -xkb ............... Compile XKB support.

    -no-glib ........... Do not compile Glib support.
 +  -glib .............. Compile Glib support.

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6# 

  

  關於 -prefix  -prefix-install  如果不指定 :

  編譯後在 embedded arm 中要把 lib  bin  放在  /usr/local/Trolltech/Qt-4.8.6 這個目錄下,不存在就需要創建

  

-prefix <dir> ...... This will install everything relative to <dir>
(default /usr/local/Trolltech/Qt-4.8.6)

* -prefix-install .... Force a sandboxed "local" installation of
Qt. This will install into
/usr/local/Trolltech/Qt-4.8.6, if this option is
disabled then some platforms will attempt a
"system" install by placing default values
in a system location other than PREFIX.

  

  我的./configure

-I後面指定上一步tslib的include路徑,-L後面指定上一步tslib的lib路徑,

./configure  -opensource -release -shared -Declarative -importdir /opt/imports -fast -no-largefile -qt-sql-sqlite -qt3support -exceptions  -xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -svg -webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg  -make libs -make tools -make examples -make demos  -make translations -nomake docs -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb   -armfpa   -DQT_QLOCALE_USES_FCVT -DQT_NO_QWS_CURSOR -no-pch -I/usr/local/tslib/include -L/usr/local/tslib/lib -confirm-license  

 

  這兒的重要參數就是,其實都是重要參數. 這個需要看的比較多.

  需要編譯webkit,demos 因為demos 包含了我們需要的browser示例.

 

  如果出現以下錯誤,則是 mkspecs/qws/linux-arm-g++/qmake.conf 中編譯器沒找到路徑,所以用全路徑啊.:

  

The tslib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR and QMAKE_LIBDIR in
qt-everywhere-opensource-src-4.8.6/mkspecs/qws/linux-arm-g++.

  編譯安裝:

  

make 


make install

  這兒是漫長的,差不多要5個小時.

 

  make完成後.

  打包 exe和 lib .本文直接 把 qt-everywhere-opensource-src-4.8.6\demos\browser\browser 這個exe放在lib目錄下,方便 embedded arm 下使用.

注意 lib下的 所有都有拷貝走,包含 ./lib/fonts  這個字體目錄.程序需要.

 

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6# ls -l lib
total 80204
-rw-r--r-- 1 root root   711791 Aug 23 05:56 browser
drwxr-xr-x 2 1001 1001     4096 Apr 10  2014 fonts
-rw-r--r-- 1 root root      521 Aug 22 13:10 libpvrQWSWSEGL.prl
-rw-r--r-- 1 root root      788 Aug 22 13:10 libQAxContainer.prl
-rw-r--r-- 1 root root      755 Aug 22 13:10 libQAxServer.prl
-rw-r--r-- 1 root root      899 Aug 25 20:07 libQt3Support.la
-rw-r--r-- 1 root root      863 Aug 25 20:07 libQt3Support.prl
lrwxrwxrwx 1 root root       22 Aug 25 03:33 libQt3Support.so -> libQt3Support.so.4.8.6
lrwxrwxrwx 1 root root       22 Aug 25 03:33 libQt3Support.so.4 -> libQt3Support.so.4.8.6
lrwxrwxrwx 1 root root       22 Aug 25 03:33 libQt3Support.so.4.8 -> libQt3Support.so.4.8.6
-rwxr-xr-x 1 root root  3364328 Aug 25 03:33 libQt3Support.so.4.8.6
-rw-r--r-- 1 root root      868 Aug 25 20:08 libQtCLucene.la
-rw-r--r-- 1 root root      849 Aug 25 20:08 libQtCLucene.prl
lrwxrwxrwx 1 root root       21 Aug 25 06:13 libQtCLucene.so -> libQtCLucene.so.4.8.6
lrwxrwxrwx 1 root root       21 Aug 25 06:13 libQtCLucene.so.4 -> libQtCLucene.so.4.8.6
lrwxrwxrwx 1 root root       21 Aug 25 06:13 libQtCLucene.so.4.8 -> libQtCLucene.so.4.8.6
-rwxr-xr-x 1 root root  1541589 Aug 25 06:13 libQtCLucene.so.4.8.6
-rw-r--r-- 1 root root      755 Aug 25 20:07 libQtCore.la
-rw-r--r-- 1 root root      723 Aug 25 20:07 libQtCore.prl
lrwxrwxrwx 1 root root       18 Aug 25 02:59 libQtCore.so -> libQtCore.so.4.8.6
lrwxrwxrwx 1 root root       18 Aug 25 02:59 libQtCore.so.4 -> libQtCore.so.4.8.6
lrwxrwxrwx 1 root root       18 Aug 25 02:59 libQtCore.so.4.8 -> libQtCore.so.4.8.6
-rwxr-xr-x 1 root root  4026474 Aug 25 02:59 libQtCore.so.4.8.6
-rw-r--r-- 1 root root      843 Aug 22 13:10 libQtDBus.la
-rw-r--r-- 1 root root      821 Aug 22 13:10 libQtDBus.prl
-rw-r--r-- 1 root root      947 Aug 25 20:07 libQtDeclarative.la
-rw-r--r-- 1 root root      881 Aug 25 20:07 libQtDeclarative.prl
lrwxrwxrwx 1 root root       25 Aug 25 04:04 libQtDeclarative.so -> libQtDeclarative.so.4.8.6
lrwxrwxrwx 1 root root       25 Aug 25 04:04 libQtDeclarative.so.4 -> libQtDeclarative.so.4.8.6
lrwxrwxrwx 1 root root       25 Aug 25 04:04 libQtDeclarative.so.4.8 -> libQtDeclarative.so.4.8.6
-rwxr-xr-x 1 root root  4694510 Aug 25 04:04 libQtDeclarative.so.4.8.6
-rw-r--r-- 1 root root      604 Aug 25 20:08 libQtDesignerComponents.prl
lrwxrwxrwx 1 root root       32 Aug 25 06:34 libQtDesignerComponents.so -> libQtDesignerComponents.so.4.8.6
lrwxrwxrwx 1 root root       32 Aug 25 06:34 libQtDesignerComponents.so.4 -> libQtDesignerComponents.so.4.8.6
lrwxrwxrwx 1 root root       32 Aug 25 06:34 libQtDesignerComponents.so.4.8 -> libQtDesignerComponents.so.4.8.6
-rwxr-xr-x 1 root root  3491318 Aug 25 06:34 libQtDesignerComponents.so.4.8.6
-rw-r--r-- 1 root root      548 Aug 25 20:08 libQtDesigner.prl
lrwxrwxrwx 1 root root       22 Aug 25 06:27 libQtDesigner.so -> libQtDesigner.so.4.8.6
lrwxrwxrwx 1 root root       22 Aug 25 06:27 libQtDesigner.so.4 -> libQtDesigner.so.4.8.6
lrwxrwxrwx 1 root root       22 Aug 25 06:27 libQtDesigner.so.4.8 -> libQtDesigner.so.4.8.6
-rwxr-xr-x 1 root root  6113245 Aug 25 06:27 libQtDesigner.so.4.8.6
-rw-r--r-- 1 root root      840 Aug 25 20:07 libQtGui.la
-rw-r--r-- 1 root root      815 Aug 25 20:07 libQtGui.prl
lrwxrwxrwx 1 root root       17 Aug 25 03:28 libQtGui.so -> libQtGui.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 03:28 libQtGui.so.4 -> libQtGui.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 03:28 libQtGui.so.4.8 -> libQtGui.so.4.8.6
-rwxr-xr-x 1 root root 12834491 Aug 25 03:28 libQtGui.so.4.8.6
-rw-r--r-- 1 root root      863 Aug 25 20:08 libQtHelp.la
-rw-r--r-- 1 root root      846 Aug 25 20:08 libQtHelp.prl
lrwxrwxrwx 1 root root       18 Aug 25 06:15 libQtHelp.so -> libQtHelp.so.4.8.6
lrwxrwxrwx 1 root root       18 Aug 25 06:15 libQtHelp.so.4 -> libQtHelp.so.4.8.6
lrwxrwxrwx 1 root root       18 Aug 25 06:15 libQtHelp.so.4.8 -> libQtHelp.so.4.8.6
-rwxr-xr-x 1 root root   651089 Aug 25 06:15 libQtHelp.so.4.8.6
-rw-r--r-- 1 root root     1013 Aug 22 13:10 libQtMeeGoGraphicsSystemHelper.la
-rw-r--r-- 1 root root      903 Aug 22 13:10 libQtMeeGoGraphicsSystemHelper.prl
-rw-r--r-- 1 root root      897 Aug 25 20:07 libQtMultimedia.la
-rw-r--r-- 1 root root      835 Aug 25 20:07 libQtMultimedia.prl
lrwxrwxrwx 1 root root       24 Aug 25 03:46 libQtMultimedia.so -> libQtMultimedia.so.4.8.6
lrwxrwxrwx 1 root root       24 Aug 25 03:46 libQtMultimedia.so.4 -> libQtMultimedia.so.4.8.6
lrwxrwxrwx 1 root root       24 Aug 25 03:46 libQtMultimedia.so.4.8 -> libQtMultimedia.so.4.8.6
-rwxr-xr-x 1 root root   221760 Aug 25 03:46 libQtMultimedia.so.4.8.6
-rw-r--r-- 1 root root      856 Aug 25 20:07 libQtNetwork.la
-rw-r--r-- 1 root root      806 Aug 25 20:07 libQtNetwork.prl
lrwxrwxrwx 1 root root       21 Aug 25 03:02 libQtNetwork.so -> libQtNetwork.so.4.8.6
lrwxrwxrwx 1 root root       21 Aug 25 03:02 libQtNetwork.so.4 -> libQtNetwork.so.4.8.6
lrwxrwxrwx 1 root root       21 Aug 25 03:02 libQtNetwork.so.4.8 -> libQtNetwork.so.4.8.6
-rwxr-xr-x 1 root root  1606434 Aug 25 03:02 libQtNetwork.so.4.8.6
-rw-r--r-- 1 root root      869 Aug 22 13:10 libQtOpenGL.la
-rw-r--r-- 1 root root      824 Aug 22 13:10 libQtOpenGL.prl
-rw-r--r-- 1 root root      869 Aug 22 13:10 libQtOpenVG.la
-rw-r--r-- 1 root root      824 Aug 22 13:10 libQtOpenVG.prl
-rw-r--r-- 1 root root      516 Aug 22 13:10 libQtRemote.prl
-rw-r--r-- 1 root root      849 Aug 25 20:07 libQtScript.la
-rw-r--r-- 1 root root      831 Aug 25 20:07 libQtScript.prl
lrwxrwxrwx 1 root root       20 Aug 25 03:55 libQtScript.so -> libQtScript.so.4.8.6
lrwxrwxrwx 1 root root       20 Aug 25 03:55 libQtScript.so.4 -> libQtScript.so.4.8.6
lrwxrwxrwx 1 root root       20 Aug 25 03:55 libQtScript.so.4.8 -> libQtScript.so.4.8.6
-rwxr-xr-x 1 root root  3052585 Aug 25 03:55 libQtScript.so.4.8.6
-rw-r--r-- 1 root root      915 Aug 25 20:08 libQtScriptTools.la
-rw-r--r-- 1 root root      849 Aug 25 20:08 libQtScriptTools.prl
lrwxrwxrwx 1 root root       25 Aug 25 06:08 libQtScriptTools.so -> libQtScriptTools.so.4.8.6
lrwxrwxrwx 1 root root       25 Aug 25 06:08 libQtScriptTools.so.4 -> libQtScriptTools.so.4.8.6
lrwxrwxrwx 1 root root       25 Aug 25 06:08 libQtScriptTools.so.4.8 -> libQtScriptTools.so.4.8.6
-rwxr-xr-x 1 root root   983124 Aug 25 06:08 libQtScriptTools.so.4.8.6
-rw-r--r-- 1 root root      828 Aug 25 20:07 libQtSql.la
-rw-r--r-- 1 root root      794 Aug 25 20:07 libQtSql.prl
lrwxrwxrwx 1 root root       17 Aug 25 03:03 libQtSql.so -> libQtSql.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 03:03 libQtSql.so.4 -> libQtSql.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 03:03 libQtSql.so.4.8 -> libQtSql.so.4.8.6
-rwxr-xr-x 1 root root   844732 Aug 25 03:03 libQtSql.so.4.8.6
-rw-r--r-- 1 root root      848 Aug 25 20:07 libQtSvg.la
-rw-r--r-- 1 root root      814 Aug 25 20:07 libQtSvg.prl
lrwxrwxrwx 1 root root       17 Aug 25 03:47 libQtSvg.so -> libQtSvg.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 03:47 libQtSvg.so.4 -> libQtSvg.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 03:47 libQtSvg.so.4.8 -> libQtSvg.so.4.8.6
-rwxr-xr-x 1 root root   428747 Aug 25 03:47 libQtSvg.so.4.8.6
-rw-r--r-- 1 root root      835 Aug 25 20:07 libQtTest.la
-rw-r--r-- 1 root root      803 Aug 25 20:07 libQtTest.prl
lrwxrwxrwx 1 root root       18 Aug 25 03:04 libQtTest.so -> libQtTest.so.4.8.6
lrwxrwxrwx 1 root root       18 Aug 25 03:04 libQtTest.so.4 -> libQtTest.so.4.8.6
lrwxrwxrwx 1 root root       18 Aug 25 03:04 libQtTest.so.4.8 -> libQtTest.so.4.8.6
-rwxr-xr-x 1 root root   195211 Aug 25 03:04 libQtTest.so.4.8.6
-rw-r--r-- 1 root root  1315980 Aug 25 06:20 libQtUiTools.a
-rw-r--r-- 1 root root      730 Aug 25 20:08 libQtUiTools.prl
-rw-r--r-- 1 root root      943 Aug 25 20:08 libQtWebKit.la
-rw-r--r-- 1 root root      804 Aug 25 20:08 libQtWebKit.prl
lrwxrwxrwx 1 root root       20 Aug 25 06:04 libQtWebKit.so -> libQtWebKit.so.4.9.4
lrwxrwxrwx 1 root root       20 Aug 25 06:04 libQtWebKit.so.4 -> libQtWebKit.so.4.9.4
lrwxrwxrwx 1 root root       20 Aug 25 06:04 libQtWebKit.so.4.9 -> libQtWebKit.so.4.9.4
-rwxr-xr-x 1 root root 29722397 Aug 25 06:04 libQtWebKit.so.4.9.4
-rw-r--r-- 1 root root      828 Aug 25 20:07 libQtXml.la
-rw-r--r-- 1 root root      896 Aug 25 20:07 libQtXmlPatterns.la
-rw-r--r-- 1 root root      830 Aug 25 20:07 libQtXmlPatterns.prl
lrwxrwxrwx 1 root root       25 Aug 25 03:46 libQtXmlPatterns.so -> libQtXmlPatterns.so.4.8.6
lrwxrwxrwx 1 root root       25 Aug 25 03:46 libQtXmlPatterns.so.4 -> libQtXmlPatterns.so.4.8.6
lrwxrwxrwx 1 root root       25 Aug 25 03:46 libQtXmlPatterns.so.4.8 -> libQtXmlPatterns.so.4.8.6
-rwxr-xr-x 1 root root  5547166 Aug 25 03:46 libQtXmlPatterns.so.4.8.6
-rw-r--r-- 1 root root      794 Aug 25 20:07 libQtXml.prl
lrwxrwxrwx 1 root root       17 Aug 25 02:59 libQtXml.so -> libQtXml.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 02:59 libQtXml.so.4 -> libQtXml.so.4.8.6
lrwxrwxrwx 1 root root       17 Aug 25 02:59 libQtXml.so.4.8 -> libQtXml.so.4.8.6
-rwxr-xr-x 1 root root   347438 Aug 25 02:59 libQtXml.so.4.8.6
lrwxrwxrwx 1 root root       18 Aug 23 21:56 libts-1.0.so.0 -> libts-1.0.so.0.0.0
-rwxr-xr-x 1 root root    13122 Aug 23 21:56 libts-1.0.so.0.0.0
-rwxr-xr-x 1 root root      937 Aug 23 21:56 libts.la
lrwxrwxrwx 1 root root       18 Aug 23 21:56 libts.so -> libts-1.0.so.0.0.0
drwxr-xr-x 2 root root     4096 Aug 23 21:56 pkgconfig
-rwxrwxrwx 1 1001 1001       75 Apr 10  2014 README
drwxr-xr-x 2 root root     4096 Aug 23 21:56 ts
root@debian:/disk2/qt-everywhere-opensource-src-4.8.6# 

 

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6# ls
bin              demos               lib           Makefile      templates
changes-4.8.6    doc                 lib2          mkspecs       tools
config.profiles  examples            lib2.tar.gz   plugins       translations
config.status    imports             lib3.tar.gz   projects.pro  util
config.tests     include             LICENSE.FDL   qmake
configure        INSTALL             LICENSE.GPL3  README
configure.exe    LGPL_EXCEPTION.txt  LICENSE.LGPL  src
root@debian:/disk2/qt-everywhere-opensource-src-4.8.6# tar -zcf lib.tar.gz lib
root@debian:/disk2/qt-everywhere-opensource-src-4.8.6# cd /usr/local/
root@debian:/usr/local# ls
arm-linux-lib  etc    include  man   share  tslib
bin            games  lib      sbin  src    tslib.tar.gz
root@debian:/usr/local# tar -zcf tslib.tar.gz tslib

 

 6,移植到Embedded arm 

   

  

   上面有說到:

  "

  關於 -prefix  -prefix-install  如果不指定 :

  編譯後在 embedded arm 中要把 lib  bin  放在  /usr/local/Trolltech/Qt-4.8.6 這個目錄下,不存在就需要創建

  "

  所以 創建  /usr/local/Trolltech/Qt-4.8.6

  

  結果一運行程序 傻眼了,是 

  /usr/local/Trolltech/QtEmbedded-4.8.6-arm

  把  lib.tar.gz  tslib.tar.gz 拷貝到 /usr/local/Trolltech/QtEmbedded-4.8.6-arm 目錄下並解壓:

  

tar -xzvf lib.tar.gz 
tar -xzvf tslib.tar.gz 

 

  

  配置 so加載路徑:

  

# nano /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

/usr/local/Trolltech/QtEmbedded-4.8.6-arm/tslib/lib
/usr/local/Trolltech/QtEmbedded-4.8.6-arm/lib

   運行:

  

  ldconfig

 

  再運行:

  

#  ./lib/browser
QWSSocket::connectToLocalFile could not connect:: No such file or directory
QWSSocket::connectToLocalFile could not connect:: No such file or directory
QWSSocket::connectToLocalFile could not connect:: No such file or directory
QWSSocket::connectToLocalFile could not connect:: No such file or directory
QWSSocket::connectToLocalFile could not connect:: No such file or directory
QWSSocket::connectToLocalFile could not connect:: No such file or directory
No Qt for Embedded Linux server appears to be running.
If you want to run this program as a server,
add the "-qws" command-line option.

 

提示以-qws方式 運行...上文已經多次提到過 qws了吧.這兒就不說了

#  ./lib/browser -qws
QSslSocket: cannot resolve SSLv2_client_method
QSslSocket: cannot resolve SSLv2_server_method

如果想打開某一個網頁如百度,請使用命令:./browser -qws http://www.baidu.com

 

  

  存在問題鼠標不能操作(後面發現鼠標存在,只是顏色透明,且移動飛快...),鍵盤 沒有中文輸入法 .後續解決

 

 

7,單獨對qt-everywhere-opensource-src-4.8.6\demos\browser 的編譯.

  qt庫有了後就不需要再次去編譯整個項目了,原因你懂的,每次編譯5個小時,要瘋的.

  所以需要單獨對 browser項目進行編譯.

  進入 browser 目錄.

  使用

  /disk2/qt-everywhere-opensource-src-4.8.6/bin/qmake  -project

  生成  browser.pro 

  由於對整個qt工程編譯時已經生成,故可以跳過

  

  編譯browser.pro文件. 因為每次 make 都會調用  browser.pro重新 生成 Makefile 文件... 所以對Makefile文件修改,就不太管用了.

  

######################################################################
# Automatically generated by qmake (2.01a) Tue Aug 25 07:41:23 2015
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += . data htmls
INCLUDEPATH += . "../../include/QtWebKit"
QMAKE_LIBS += -lQtWebKit -lQtGui  
# Input
HEADERS += autosaver.h \
           bookmarks.h \
           browserapplication.h \
           browsermainwindow.h \
           chasewidget.h \
           cookiejar.h \
           downloadmanager.h \
           edittableview.h \
           edittreeview.h \
           history.h \
           modelmenu.h \
           networkaccessmanager.h \
           searchlineedit.h \
           settings.h \
           squeezelabel.h \
           tabwidget.h \
           toolbarsearch.h \
           urllineedit.h \
           webview.h \
           xbel.h
FORMS += addbookmarkdialog.ui \
         bookmarks.ui \
         cookies.ui \
         cookiesexceptions.ui \
         downloaditem.ui \
         downloads.ui \
         history.ui \
         passworddialog.ui \
         proxy.ui \
         settings.ui
SOURCES += autosaver.cpp \
           bookmarks.cpp \
           browserapplication.cpp \
           browsermainwindow.cpp \
           chasewidget.cpp \
           cookiejar.cpp \
           downloadmanager.cpp \
           edittableview.cpp \
           edittreeview.cpp \
           history.cpp \
           main.cpp \
           modelmenu.cpp \
           networkaccessmanager.cpp \
           searchlineedit.cpp \
           settings.cpp \
           squeezelabel.cpp \
           tabwidget.cpp \
           toolbarsearch.cpp \
           urllineedit.cpp \
           webview.cpp \
           xbel.cpp
RESOURCES += data/data.qrc htmls/htmls.qrc

 

    增加 新的引用庫 和頭文件目錄 

INCLUDEPATH += . "../../include/QtWebKit"
QMAKE_LIBS += -lQtWebKit -lQtGui  

   

  ...

  原 main.cpp文件:

  

#include "browserapplication.h"

int main(int argc, char **argv)
{
    Q_INIT_RESOURCE(data);
    BrowserApplication application(argc, argv);
    if (!application.isTheOnlyBrowser())
        return 0;
    application.newMainWindow();
    return application.exec();
}

 

現改為:

#include "browserapplication.h"
#include "browsermainwindow.h"

#include <QtGui/QApplication>
#include <QTextCodec>
#include <QWSServer>
//#include <QT>
#include<QFont>

int main(int argc, char **argv)
{
    //QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
    //QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
                      
    Q_INIT_RESOURCE(data);
    BrowserApplication application(argc, argv);

    //application.setOverrideCursor(Qt::BlankCursor);   //隱藏鼠標
    //application.setOverrideCursor(Qt::ArrowCursor);  //顯示正常鼠標
    application.setOverrideCursor(Qt::ArrowCursor);

    //設置windows 自帶宋體
    //QFont font;
    //font.setPointSize(26);
    //font.setFamily(("simsun"));
    //application.setFont(font);

    QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));

    QTextCodec *codec = QTextCodec::codecForName("GBK");
    
    application.setFont(QFont("wenquanyi", 10));

    //QWSServer::setCursorVisible(false);
    if (!application.isTheOnlyBrowser())
        return 0;

    BrowserMainWindow  * pMainWindow=NULL;
    pMainWindow=application.newMainWindow();
    pMainWindow->showFullScreen();//全屏

    return application.exec();
}

 

   這兒使用了 文泉驿 字體  

 application.setFont(QFont("wenquanyi", 10));

  下載: http://download.csdn.net/download/chenaini119/7867415

  下載解壓後,放入 

Embedded arm 中的

/usr/local/Trolltech/QtEmbedded-4.8.6-arm/lib/fonts 中

 

   編譯:

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6/demos/browser# /disk2/qt-everywhere-opensource-src-4.8.6/bin/qmake
root@debian:/disk2/qt-everywhere-opensource-src-4.8.6/demos/browser# make

 

  可能出現錯誤1:

  make[2]: Nothing to be done for `first'.

  ----

  當前工程是的代碼沒有更改.

  運行 

  /disk2/qt-everywhere-opensource-src-4.8.6/bin/qmake  

  根據 browser.pro 以生成 Makefile文件

  再

  make

 

  或者 make clean 清除

   或刪除

  /disk2/qt-everywhere-opensource-src-4.8.6/demos/browser 下面的隱藏文件

  

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6/demos/browser# find . -name '.*'
.
./.pch
./.moc
./.obj
./.uic
./.rcc
root@debian:/disk2/qt-everywhere-opensource-src-4.8.6/demos/browser# rm -rf .obj

 

   

 可能出現錯誤2:

/release-shared-emb-arm -o .obj/release-shared-emb-arm/bookmarks.o bookmarks.cpp
In file included from bookmarks.cpp:46:0:
history.h:55:32: fatal error: QWebHistoryInterface: No such file or directory

  出現編譯錯誤 缺少 QtWebKit

  browser.pro中添加

INCLUDEPATH += . "../../include/QtWebKit" 
QMAKE_LIBS += -lQtWebKit -lQtGui   

  

######################################################################
# Automatically generated by qmake (2.01a) Tue Aug 25 07:41:23 2015
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += . data htmls
#CONFIG += uitools
INCLUDEPATH += . "../../include/QtWebKit" 
QMAKE_LIBS += -lQtWebKit -lQtGui   
# Input


#............後面省略....

 

  可能出現錯誤3:

 程序連接時找不到 QUiLoader 所在的庫

  webview.cpp:(.text+0x2d8): undefined reference to `QUiLoader::QUiLoader(QObject*)'
sk2/qt-everywhere-opensource-src-4.8.6/lib -lQtGui -lQtNetwork -lQtCore -lpthread 
.obj/release-shared-emb-arm/webview.o: In function `WebPage::createPlugin(QString const&, QUrl const&, QStringList const&, QStringList const&)':
webview.cpp:(.text+0x2d8): undefined reference to `QUiLoader::QUiLoader(QObject*)'
webview.cpp:(.text+0x318): undefined reference to `QUiLoader::createWidget(QString const&, QWidget*, QString const&)'
webview.cpp:(.text+0x344): undefined reference to `QUiLoader::~QUiLoader()'
webview.cpp:(.text+0x36c): undefined reference to `QUiLoader::~QUiLoader()'

 

   在lib 下面查找:

  

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6/lib# find . -name '*Tools*'
./libQtScriptTools.so
./libQtUiTools.prl
./libQtScriptTools.so.4.8
./pkgconfig/QtUiTools.pc
./pkgconfig/QtScriptTools.pc
./libQtScriptTools.so.4
./libQtScriptTools.so.4.8.6
./libQtScriptTools.prl
./libQtScriptTools.la
./libQtUiTools.a

 

   存在一個  ./libQtUiTools.a  的靜態庫文件.

  

  修改 browser.pro文件

  

######################################################################
# Automatically generated by qmake (2.01a) Tue Aug 25 07:41:23 2015
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += . data htmls
#CONFIG += uitools
INCLUDEPATH += . "../../include/QtWebKit" "../../include/QtUiTools"
QMAKE_LIBS += -lQtWebKit -lQtGui   -lQtUiTools
# Input


#............後面省略..............

 

 

root@debian:/disk2/qt-everywhere-opensource-src-4.8.6/demos/browser# ls -la
total 3248
drwxr-xr-x  9 1001 1001    4096 Aug 26 12:48 .
drwxr-xr-x 32 1001 1001    4096 Aug 23 05:47 ..
-rw-r--r--  1 1001 1001    2300 Apr 10  2014 addbookmarkdialog.ui
-rw-r--r--  1 1001 1001    3134 Apr 10  2014 autosaver.cpp
-rw-r--r--  1 1001 1001    2638 Apr 10  2014 autosaver.h
-rw-r--r--  1 1001 1001   31630 Apr 10  2014 bookmarks.cpp
-rw-r--r--  1 1001 1001    8981 Apr 10  2014 bookmarks.h
-rw-r--r--  1 1001 1001    2544 Apr 10  2014 bookmarks.ui
-rwxr-xr-x  1 root root 1404709 Aug 26 12:48 browser

  ./browser 已經成功生成 .

  

  再上個圖

  

  

  中文 已經有了,,雖然有些丑...將就吧.

  

   在運行時候加個參數 ./browser -qws -nomouse 這個是禁止了所有的鼠標功能,連點擊都不響應 -mouse是使用鼠標.

  但程序運行後還是沒有看見光標

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved