linux(debian) arm-linux-g++ v4.5.1交叉编译 embedded arm 版本的QtWebkit (browser) 使用qt 4.8.6 版本 以及x64上编译qt

最近需要做一个项目 在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. 前言

  2. 下载tslib和qt

  3. openssl 安装低版本 (1.0.2),如果安装openssl 1.1.0,会出错.
  4. 交叉编译器机所在linux的环境准备

  5. 编译tslib

  6. 编译安装qt

  7. 移植到Embedded arm

  8. 单独对qt-everywhere-opensource-src-4.8.6\demos\browser 的编译.

存在问题鼠标不能操作(后面发现鼠标存在,只是颜色透明,且移动飞快...),键盘 没有中文输入法 .后续待解决

1,前言

引用

Qt 4.8.6 X11、embeded x86(qvfb运行 )、embeded arm各个版本编译总结

的话:

QT是跨平台C++图形用户界面应用程序开发框架,可以实现一套源码,多个平台编译运行。可视为平台无关的开发环境。

QT源码可以被编译成很多个版本,这里介绍3个版本:linux桌面版(X11),embeded x86版,embeded arm版。编译后生成对应平台库文件,使用某平台的编译器编译应用程序时就会链接对应平台的库文件,这样应用程序就能在该平台下运行。

、X11版(默认版本)
X11版本的QT可以在使用X windows系统的linux 桌面操作系统上运行(我用的是Ubuntu),如果不需要开发桌面应用程序,可以不编译。 、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中仿真运行,看看界面,不必下载到开发板的文件系统中运行,两者的运行效果除了界面基本相同,其他方面还是有差异的。 、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::: 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,openssl 安装低版本 (1.0.2),如果安装openssl 1.1.0 ,会出错.

https://github.com/Ultimaker/cura-build/issues/105

安装openssl1.1.0版本会报,

/usr/include/openssl/ossl_typ.h:119:16: note: forward declaration of ‘X509 {aka struct x509_st}’
typedef struct x509_st X509;
的错( invalid use of incomplete type  x509)

4,交叉编译器机所在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./bin/../libexec/gcc/arm-none-linux-gnueabi/4.5./lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /work/toolchain/build/src/gcc-4.5./configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.5. --with-sysroot=/opt/FriendlyARM/toolschain/4.5./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.-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. (ctng-1.8.-FA)
root@debian:/disk2#

  

5, 编译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”,注意一定要顶格。

  

6,编译安装qt

  难啃的骨头终于开始了. !!!

  

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

  

  打开 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./bin/arm-linux-gcc -lts
QMAKE_CXX = /usr/arm-linux-g++_4.5.1/4.5./bin/arm-linux-g++ -lts
QMAKE_LINK = /usr/arm-linux-g++_4.5.1/4.5./bin/arm-linux-g++ -lts
QMAKE_LINK_SHLIB = /usr/arm-linux-g++_4.5.1/4.5./bin/arm-linux-g++ -lts # modifications to linux.conf
QMAKE_AR = /usr/arm-linux-g++_4.5.1/4.5./bin/arm-linux-ar cqs
QMAKE_OBJCOPY = /usr/arm-linux-g++_4.5.1/4.5./bin/arm-linux-objcopy
QMAKE_STRIP = /usr/arm-linux-g++_4.5.1/4.5./bin/arm-linux-strip load(qt_config)

  为防止找不到路径,所以直接全路径了.  简单粗暴.

  再来看看

  ./configure --help

  

root@debian:/disk2/qt-everywhere-opensource-src-4.8.# ./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/QtEmbedded-4.8.6)     -hostprefix [dir] .. Tools and libraries needed when developing
                         applications are installed in [dir]. If [dir] is
                         not given, the current build directory will be used.   * -prefix-install .... Force a sandboxed "local" installation of
                         Qt. This will install into
                         /usr/local/Trolltech/QtEmbedded-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 (qws/linux-x86_64-g++).                          See the README file for a list of supported
                         operating systems and compilers.     -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 for Embedded Linux:     -embedded <arch> .... This will enable the embedded build, you must have a
                          proper license for this switch to work.
                          Example values for <arch>: arm mips x86 generic     -xplatform target ... The target platform when cross-compiling.     -device-option <key=value> ... Add device specific options for the device mkspec
                                   (experimental)     -no-feature-<feature> Do not compile in <feature>.
    -feature-<feature> .. Compile in <feature>. The available features
                          are described in src/corelib/global/qfeatures.txt     -armfpa ............. Target platform uses the ARM-FPA floating point format.
    -no-armfpa .......... Target platform does not use the ARM-FPA floating point format.                           The floating point format is usually autodetected by configure. Use this
                          to override the detected value.     -little-endian ...... Target platform is little endian (LSB first).
    -big-endian ......... Target platform is big endian (MSB first).     -host-little-endian . Host platform is little endian (LSB first).
    -host-big-endian .... Host platform is big endian (MSB first).                           You only need to specify the endianness when
                          cross-compiling, otherwise the host
                          endianness will be used.     -no-freetype ........ Do not compile in Freetype2 support.
    -qt-freetype ........ Use the libfreetype bundled with Qt.
 *  -system-freetype .... Use libfreetype from the operating system.
                          See http://www.freetype.org/     -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
                          default (full).     -no-opengl .......... Do not support OpenGL.
    -opengl <api> ....... Enable OpenGL ES support
                          With no parameter, this will attempt to auto-detect OpenGL ES 1.x
                          or 2.x, or regular desktop OpenGL.
                          Use es1 or es2 for <api> to override auto-detection.     -depths <list> ...... Comma-separated list of supported bit-per-pixel
                          depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.     -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library,
                               by default all available decorations are on.
                               Possible values for <style>: [ styled windows default ]
    -plugin-decoration-<style> Enable decoration <style> as a plugin to be
                               linked to at run time.
                               Possible values for <style>: [  default styled windows ]
    -no-decoration-<style> ....Disable decoration <style> entirely.
                               Possible values for <style>: [ styled windows default ]     -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library.
                         Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen directfb qnx integrityfb ]
    -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be
                         linked to at run time.
                         Possible values for <driver>: [  ahi directfb eglnullws linuxfb powervr qvfb transformed vnc ]
    -no-gfx-<driver> ... Disable graphics <driver> entirely.
                         Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen directfb qnx integrityfb ]     -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library.
                         Possible values for <driver>: [ tty linuxinput qvfb qnx integrity ]     -plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to
                         at runtime.
                         Possible values for <driver>: [  linuxinput ]     -no-kbd-<driver> ... Disable keyboard <driver> entirely.
                         Possible values for <driver>: [ tty linuxinput qvfb qnx integrity ]     -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library.
                           Possible values for <driver>: [ pc linuxtp linuxinput tslib qvfb qnx integrity ]
    -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to
                           at runtime.
                           Possible values for <driver>: [  linuxtp pc tslib ]
    -no-mouse-<driver> ... Disable mouse <driver> entirely.
                           Possible values for <driver>: [ pc linuxtp linuxinput tslib qvfb qnx integrity ]     -iwmmxt ............ Compile using the iWMMXt instruction set
                         (available on some XScale CPUs).
    -no-glib ........... Do not compile Glib support.
 +  -glib .............. Compile Glib support. root@debian:/disk2/qt-everywhere-opensource-src-4.8.#

  

  关于 -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  

  这儿要改为:

  

./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 all -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.# ls -l lib
total
-rw-r--r-- root root Aug : browser
drwxr-xr-x Apr fonts
-rw-r--r-- root root Aug : libpvrQWSWSEGL.prl
-rw-r--r-- root root Aug : libQAxContainer.prl
-rw-r--r-- root root Aug : libQAxServer.prl
-rw-r--r-- root root Aug : libQt3Support.la
-rw-r--r-- root root Aug : libQt3Support.prl
lrwxrwxrwx root root Aug : libQt3Support.so -> libQt3Support.so.4.8.
lrwxrwxrwx root root Aug : libQt3Support.so. -> libQt3Support.so.4.8.
lrwxrwxrwx root root Aug : libQt3Support.so.4.8 -> libQt3Support.so.4.8.
-rwxr-xr-x root root Aug : libQt3Support.so.4.8.
-rw-r--r-- root root Aug : libQtCLucene.la
-rw-r--r-- root root Aug : libQtCLucene.prl
lrwxrwxrwx root root Aug : libQtCLucene.so -> libQtCLucene.so.4.8.
lrwxrwxrwx root root Aug : libQtCLucene.so. -> libQtCLucene.so.4.8.
lrwxrwxrwx root root Aug : libQtCLucene.so.4.8 -> libQtCLucene.so.4.8.
-rwxr-xr-x root root Aug : libQtCLucene.so.4.8.
-rw-r--r-- root root Aug : libQtCore.la
-rw-r--r-- root root Aug : libQtCore.prl
lrwxrwxrwx root root Aug : libQtCore.so -> libQtCore.so.4.8.
lrwxrwxrwx root root Aug : libQtCore.so. -> libQtCore.so.4.8.
lrwxrwxrwx root root Aug : libQtCore.so.4.8 -> libQtCore.so.4.8.
-rwxr-xr-x root root Aug : libQtCore.so.4.8.
-rw-r--r-- root root Aug : libQtDBus.la
-rw-r--r-- root root Aug : libQtDBus.prl
-rw-r--r-- root root Aug : libQtDeclarative.la
-rw-r--r-- root root Aug : libQtDeclarative.prl
lrwxrwxrwx root root Aug : libQtDeclarative.so -> libQtDeclarative.so.4.8.
lrwxrwxrwx root root Aug : libQtDeclarative.so. -> libQtDeclarative.so.4.8.
lrwxrwxrwx root root Aug : libQtDeclarative.so.4.8 -> libQtDeclarative.so.4.8.
-rwxr-xr-x root root Aug : libQtDeclarative.so.4.8.
-rw-r--r-- root root Aug : libQtDesignerComponents.prl
lrwxrwxrwx root root Aug : libQtDesignerComponents.so -> libQtDesignerComponents.so.4.8.
lrwxrwxrwx root root Aug : libQtDesignerComponents.so. -> libQtDesignerComponents.so.4.8.
lrwxrwxrwx root root Aug : libQtDesignerComponents.so.4.8 -> libQtDesignerComponents.so.4.8.
-rwxr-xr-x root root Aug : libQtDesignerComponents.so.4.8.
-rw-r--r-- root root Aug : libQtDesigner.prl
lrwxrwxrwx root root Aug : libQtDesigner.so -> libQtDesigner.so.4.8.
lrwxrwxrwx root root Aug : libQtDesigner.so. -> libQtDesigner.so.4.8.
lrwxrwxrwx root root Aug : libQtDesigner.so.4.8 -> libQtDesigner.so.4.8.
-rwxr-xr-x root root Aug : libQtDesigner.so.4.8.
-rw-r--r-- root root Aug : libQtGui.la
-rw-r--r-- root root Aug : libQtGui.prl
lrwxrwxrwx root root Aug : libQtGui.so -> libQtGui.so.4.8.
lrwxrwxrwx root root Aug : libQtGui.so. -> libQtGui.so.4.8.
lrwxrwxrwx root root Aug : libQtGui.so.4.8 -> libQtGui.so.4.8.
-rwxr-xr-x root root Aug : libQtGui.so.4.8.
-rw-r--r-- root root Aug : libQtHelp.la
-rw-r--r-- root root Aug : libQtHelp.prl
lrwxrwxrwx root root Aug : libQtHelp.so -> libQtHelp.so.4.8.
lrwxrwxrwx root root Aug : libQtHelp.so. -> libQtHelp.so.4.8.
lrwxrwxrwx root root Aug : libQtHelp.so.4.8 -> libQtHelp.so.4.8.
-rwxr-xr-x root root Aug : libQtHelp.so.4.8.
-rw-r--r-- root root Aug : libQtMeeGoGraphicsSystemHelper.la
-rw-r--r-- root root Aug : libQtMeeGoGraphicsSystemHelper.prl
-rw-r--r-- root root Aug : libQtMultimedia.la
-rw-r--r-- root root Aug : libQtMultimedia.prl
lrwxrwxrwx root root Aug : libQtMultimedia.so -> libQtMultimedia.so.4.8.
lrwxrwxrwx root root Aug : libQtMultimedia.so. -> libQtMultimedia.so.4.8.
lrwxrwxrwx root root Aug : libQtMultimedia.so.4.8 -> libQtMultimedia.so.4.8.
-rwxr-xr-x root root Aug : libQtMultimedia.so.4.8.
-rw-r--r-- root root Aug : libQtNetwork.la
-rw-r--r-- root root Aug : libQtNetwork.prl
lrwxrwxrwx root root Aug : libQtNetwork.so -> libQtNetwork.so.4.8.
lrwxrwxrwx root root Aug : libQtNetwork.so. -> libQtNetwork.so.4.8.
lrwxrwxrwx root root Aug : libQtNetwork.so.4.8 -> libQtNetwork.so.4.8.
-rwxr-xr-x root root Aug : libQtNetwork.so.4.8.
-rw-r--r-- root root Aug : libQtOpenGL.la
-rw-r--r-- root root Aug : libQtOpenGL.prl
-rw-r--r-- root root Aug : libQtOpenVG.la
-rw-r--r-- root root Aug : libQtOpenVG.prl
-rw-r--r-- root root Aug : libQtRemote.prl
-rw-r--r-- root root Aug : libQtScript.la
-rw-r--r-- root root Aug : libQtScript.prl
lrwxrwxrwx root root Aug : libQtScript.so -> libQtScript.so.4.8.
lrwxrwxrwx root root Aug : libQtScript.so. -> libQtScript.so.4.8.
lrwxrwxrwx root root Aug : libQtScript.so.4.8 -> libQtScript.so.4.8.
-rwxr-xr-x root root Aug : libQtScript.so.4.8.
-rw-r--r-- root root Aug : libQtScriptTools.la
-rw-r--r-- root root Aug : libQtScriptTools.prl
lrwxrwxrwx root root Aug : libQtScriptTools.so -> libQtScriptTools.so.4.8.
lrwxrwxrwx root root Aug : libQtScriptTools.so. -> libQtScriptTools.so.4.8.
lrwxrwxrwx root root Aug : libQtScriptTools.so.4.8 -> libQtScriptTools.so.4.8.
-rwxr-xr-x root root Aug : libQtScriptTools.so.4.8.
-rw-r--r-- root root Aug : libQtSql.la
-rw-r--r-- root root Aug : libQtSql.prl
lrwxrwxrwx root root Aug : libQtSql.so -> libQtSql.so.4.8.
lrwxrwxrwx root root Aug : libQtSql.so. -> libQtSql.so.4.8.
lrwxrwxrwx root root Aug : libQtSql.so.4.8 -> libQtSql.so.4.8.
-rwxr-xr-x root root Aug : libQtSql.so.4.8.
-rw-r--r-- root root Aug : libQtSvg.la
-rw-r--r-- root root Aug : libQtSvg.prl
lrwxrwxrwx root root Aug : libQtSvg.so -> libQtSvg.so.4.8.
lrwxrwxrwx root root Aug : libQtSvg.so. -> libQtSvg.so.4.8.
lrwxrwxrwx root root Aug : libQtSvg.so.4.8 -> libQtSvg.so.4.8.
-rwxr-xr-x root root Aug : libQtSvg.so.4.8.
-rw-r--r-- root root Aug : libQtTest.la
-rw-r--r-- root root Aug : libQtTest.prl
lrwxrwxrwx root root Aug : libQtTest.so -> libQtTest.so.4.8.
lrwxrwxrwx root root Aug : libQtTest.so. -> libQtTest.so.4.8.
lrwxrwxrwx root root Aug : libQtTest.so.4.8 -> libQtTest.so.4.8.
-rwxr-xr-x root root Aug : libQtTest.so.4.8.
-rw-r--r-- root root Aug : libQtUiTools.a
-rw-r--r-- root root Aug : libQtUiTools.prl
-rw-r--r-- root root Aug : libQtWebKit.la
-rw-r--r-- root root Aug : libQtWebKit.prl
lrwxrwxrwx root root Aug : libQtWebKit.so -> libQtWebKit.so.4.9.
lrwxrwxrwx root root Aug : libQtWebKit.so. -> libQtWebKit.so.4.9.
lrwxrwxrwx root root Aug : libQtWebKit.so.4.9 -> libQtWebKit.so.4.9.
-rwxr-xr-x root root Aug : libQtWebKit.so.4.9.
-rw-r--r-- root root Aug : libQtXml.la
-rw-r--r-- root root Aug : libQtXmlPatterns.la
-rw-r--r-- root root Aug : libQtXmlPatterns.prl
lrwxrwxrwx root root Aug : libQtXmlPatterns.so -> libQtXmlPatterns.so.4.8.
lrwxrwxrwx root root Aug : libQtXmlPatterns.so. -> libQtXmlPatterns.so.4.8.
lrwxrwxrwx root root Aug : libQtXmlPatterns.so.4.8 -> libQtXmlPatterns.so.4.8.
-rwxr-xr-x root root Aug : libQtXmlPatterns.so.4.8.
-rw-r--r-- root root Aug : libQtXml.prl
lrwxrwxrwx root root Aug : libQtXml.so -> libQtXml.so.4.8.
lrwxrwxrwx root root Aug : libQtXml.so. -> libQtXml.so.4.8.
lrwxrwxrwx root root Aug : libQtXml.so.4.8 -> libQtXml.so.4.8.
-rwxr-xr-x root root Aug : libQtXml.so.4.8.
lrwxrwxrwx root root Aug : libts-1.0.so. -> libts-1.0.so.0.0.
-rwxr-xr-x root root Aug : libts-1.0.so.0.0.
-rwxr-xr-x root root Aug : libts.la
lrwxrwxrwx root root Aug : libts.so -> libts-1.0.so.0.0.
drwxr-xr-x root root Aug : pkgconfig
-rwxrwxrwx Apr README
drwxr-xr-x root root Aug : ts
root@debian:/disk2/qt-everywhere-opensource-src-4.8.#
root@debian:/disk2/qt-everywhere-opensource-src-4.8.# ls
bin demos lib Makefile templates
changes-4.8. 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.# tar -zcf lib.tar.gz lib
root@debian:/disk2/qt-everywhere-opensource-src-4.8.# 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

7,移植到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

linux(debian)  arm-linux-g++ v4.5.1交叉编译 embedded arm 版本的QtWebkit (browser) 使用qt 4.8.6 版本 以及x64上编译qt

 

  存在问题鼠标不能操作(后面发现鼠标存在,只是颜色透明,且移动飞快...),键盘 没有中文输入法 .后续解决

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 (.01a) Tue Aug ::
###################################################################### 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 ;
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", )); //QWSServer::setCursorVisible(false);
if (!application.isTheOnlyBrowser())
return ; 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./demos/browser# /disk2/qt-everywhere-opensource-src-4.8./bin/qmake
root@debian:/disk2/qt-everywhere-opensource-src-4.8./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./demos/browser# find . -name '.*'
.
./.pch
./.moc
./.obj
./.uic
./.rcc
root@debian:/disk2/qt-everywhere-opensource-src-4.8./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 (.01a) Tue Aug ::
###################################################################### 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./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./lib# find . -name '*Tools*'
./libQtScriptTools.so
./libQtUiTools.prl
./libQtScriptTools.so.4.8
./pkgconfig/QtUiTools.pc
./pkgconfig/QtScriptTools.pc
./libQtScriptTools.so.
./libQtScriptTools.so.4.8.
./libQtScriptTools.prl
./libQtScriptTools.la
./libQtUiTools.a

  存在一个  ./libQtUiTools.a  的静态库文件.

  

  修改 browser.pro文件

  

######################################################################
# Automatically generated by qmake (.01a) Tue Aug ::
###################################################################### 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./demos/browser# ls -la
total
drwxr-xr-x Aug : .
drwxr-xr-x Aug : ..
-rw-r--r-- Apr addbookmarkdialog.ui
-rw-r--r-- Apr autosaver.cpp
-rw-r--r-- Apr autosaver.h
-rw-r--r-- Apr bookmarks.cpp
-rw-r--r-- Apr bookmarks.h
-rw-r--r-- Apr bookmarks.ui
-rwxr-xr-x root root Aug : browser

  ./browser 已经成功生成 .

  

  再上个图

  linux(debian)  arm-linux-g++ v4.5.1交叉编译 embedded arm 版本的QtWebkit (browser) 使用qt 4.8.6 版本 以及x64上编译qt

 

  中文 已经有了,,虽然有些丑...将就吧.

  

  在运行时候加个参数 ./browser -qws -nomouse 这个是禁止了所有的鼠标功能,连点击都不响应 -mouse是使用鼠标.

  但程序运行后还是没有看见光标

  上面图片 没有显示出来可能是因为  -depths 16,24,32 改为 -depths all

      -depths <list> ...... Comma-separated list of supported bit-per-pixel
                          depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.

--------2017

qupzilla->Qt-5.3.2

x64上编译命令

./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-x86_64-g++   -little-endian -qt-freetype -depths all -qt-gfx-linuxfb  -embedded x86     -DQT_QLOCALE_USES_FCVT -DQT_NO_QWS_CURSOR -no-pch  -I/usr/local/ssl/include -L/usr/local/ssl/lib  -confirm-license

可能遇到问题:

qt  qatomic_i386.h:177: Error: incorrect register `%rbx' used with `l' suffix

本来想Qt/E 先编译一个X86的版本到PC上使用qvfb仿真一下,所以就按照网上的办法开始编译

起初我编译Qt/E时 ./configure -xplatform qws/Linux-x86-g++ 是按照网上的设置

但是会报错:

incorrect register `%rbp' used with `l' suffix

这个问题其实是我的Ubuntu是64位的,所以需要将这里的编译器修改成:-xplatform qws/linux-x86_64-g++

如果你是其他架构,可以去Qt文件夹下的mkspecs和mkspecs/qws/中找 符合你的平台要求的编译器

/home/webkittest/qt-everywhere-opensource-src-4.8.6/tools/designer/src/lib/shared/previewmanager.cpp:820:16: error: cannot convert âboolâ to âQWidget*â in return false

改为return 0;

x64 ,gcc6,C++11,itemviews.cpp:396:74: error: invalid conversion from  int  to  QFlags<QItemSelectionModel::SelectionFlag>::Zero {aka void**}  [-fpermissive]

http://www.qtcentre.org/threads/48957-error-invalid-conversion-from-%E2%80%98int%E2%80%99-to-%E2%80%98InitializationState

改为

  

view()->selectionModel()->select(index,
QItemSelectionModel::Columns & QItemSelectionModel::Deselect ); view()->selectionModel()->select(index,
QItemSelectionModel::SelectionFlags(
QItemSelectionModel::Columns & QItemSelectionModel::Deselect ));

x64下  error: shift expression  (1048575 << 20)  overflows [-fpermissive]

gcc6编译时,报错.

https://lists.yoctoproject.org/pipermail/yocto/2016-July/031272.html

error: enumerator value for  BackgroundMask  is not an integer constant
qt-everywhere-opensource-src-4.8.6/src/xmlpatterns/api/qcoloroutput_p.h
 error: shift expression  (1048575 << 20)  overflows [-fpermissive]

+| api/qcoloroutput_p.h:74:60: error: shift expression '(1048575 << 20)' overflows [-fpermissive]
+| api/qcoloroutput_p.h:74:63: error: enumerator value for 'BackgroundMask' is not an integer constant
+| BackgroundMask = ((1 << BackgroundShift) - 1) << BackgroundShift 改为:
class ColorOutput
    {
        enum
        {
            ForegroundShift = 10,
            BackgroundShift = 20,
            SpecialShift    = 20,
            //gcc 6之前版本使用
            //ForegroundMask  = ((1 << ForegroundShift) - 1) << ForegroundShift,
            //BackgroundMask  = ((1 << BackgroundShift) - 1) << BackgroundShift
            //gcc 6使用下面
            ForegroundMask  = 0x1f << ForegroundShift,
            BackgroundMask  = 0x7 << BackgroundShift
        };
  ..........

x64 gcc6 C++11下 error: std::tr1 has not been declaredfrom

from ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp:50:
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:69: error: std::tr1 has not been declared
     template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
                                                                     ^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:74: error: expected â{â before âhas_trivial_constructorâ
     template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
                                                                          ^~~~~~~~~~~~~~~~~~~~~~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:68: error: âstd::tr1â has not been declared
     template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
                                                                    ^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:73: error: expected â{â before âhas_trivial_destructorâ
     template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
                                                                         ^~~~~~~~~~~~~~~~~~~~~~

  修改 qt-everywhere-opensource-src-4.8.6/src/script/script.pro为如下:

TARGET     = QtScript
QPRO_PWD = $$PWD
QT = core
DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror WTF=QTWTF
DEFINES += QT_BUILD_SCRIPT_LIB
DEFINES += QT_NO_USING_NAMESPACE
DEFINES += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
#win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 ### FIXME unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore include(../qbase.pri) CONFIG += building-libs # FIXME: shared the statically built JavaScriptCore # Fetch the base WebKit directory from the WEBKITDIR environment variable;
# fall back to src/3rdparty otherwise
WEBKITDIR = $$(WEBKITDIR)
isEmpty(WEBKITDIR) {
WEBKITDIR = $$PWD/../3rdparty/javascriptcore
GENERATED_SOURCES_DIR = generated
} else {
message(using external WebKit from $$WEBKITDIR)
CONFIG -= QTDIR_build
}
include($$WEBKITDIR/WebKit.pri) # Disable a few warnings on Windows.
# These are in addition to the ones disabled in WebKit.pri
win32-msvc*: QMAKE_CXXFLAGS += -wd4396 -wd4099 # Windows CE-specific stuff copied from WebCore.pro
# ### Should rather be in JavaScriptCore.pri?
wince* {
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/os-wince
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/os-win32
LIBS += -lmmtimer
} !qpa:mac {
DEFINES += ENABLE_JSC_MULTIPLE_THREADS=
LIBS_PRIVATE += -framework AppKit
}
qpa:mac {
DEFINES += ENABLE_JSC_MULTIPLE_THREADS=
!ios {
LIBS_PRIVATE += -framework CoreServices
} else {
LIBS_PRIVATE += -framework CoreFoundation
}
} include($$WEBKITDIR/JavaScriptCore/JavaScriptCore.pri) INCLUDEPATH += $$WEBKITDIR/JavaScriptCore
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/parser
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/bytecompiler
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/debugger
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/runtime
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/wtf
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/unicode
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/interpreter
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/jit
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/profiler
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/wrec
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/API
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/bytecode
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/assembler
INCLUDEPATH += $$WEBKITDIR/JavaScriptCore/generated # This line copied from WebCore.pro
DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS= WTF_CHANGES= CONFIG(release, debug|release):DEFINES += NDEBUG solaris-g++:isEqual(QT_ARCH,sparc) {
CONFIG -= separate_debug_info
CONFIG += no_debug_info
} # Avoid JSC C API functions being exported.
DEFINES += JS_NO_EXPORT INCLUDEPATH += $$PWD include(script.pri) symbian {
TARGET.UID3=0x2001B2E1
} symbian {
symbian-abld|symbian-sbsv2 {
MMP_RULES += ALWAYS_BUILD_AS_ARM
} else {
QMAKE_CFLAGS -= --thumb
QMAKE_CXXFLAGS -= --thumb
}
QMAKE_CXXFLAGS.ARMCC += -OTime -O3
} integrity {
CFLAGS += --diag_remark=,
} # WebKit doesn't compile in C++0x mode
*-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x # gcc6
# Fixes compilation errors with GCC 6.1.
QMAKE_CXXFLAGS += -std=gnu++

debugging/qscriptdebuggerconsole.cpp:492:16: error: cannot convert  bool  to  QScriptDebuggerConsoleCommandJob*  in return
         return false;

webkittest/qt-everywhere-opensource-src-4.8.6/src/scripttools/debugging/qscriptdebuggerconsole.cpp

QScriptDebuggerConsoleCommandJob *QScriptDebuggerConsole::consumeInput(
    const QString &input, QScriptMessageHandlerInterface *messageHandler,
    QScriptDebuggerCommandSchedulerInterface *commandScheduler)
{

...

if (check.state() == QScriptSyntaxCheckResult::Intermediate)
        return 0;

...

}

改为return 0


上一篇:[No0000AB]用Visual Studio 2015在 WIN10 64bit 上编译7-zip (32 bit)


下一篇:Unity3D - 图形性能优化:优化着色器载入时间