【研究Qt webengine 模块编译】linux 交叉编译qt5.12的webengine模块成功的条件

前言

需要对qt进行交叉编译同时也要依赖web模块,尝试编译了几次编程过程总体没报错但是webengine模块都没有被成功构建,于是在源码包搜了下编译条件.

必备条件

首先看webengine的构建条件

首先检测
***QtGui 这个都有吧就不解释了
报错信息:QtWebEngine requires QtGui


src/3rdparty/chromium,这个都源码包里也有
报错信息:Submodule qtwebengine-chromium does not exist. Run ‘git submodule update --init’.


然后检测构建路径的合法性
报错信息:QtWebEngine cannot be built in a path that contains whitespace characters.


检查平台是否支持(支持的平台:Windows,Linux,macOS)
报错信息:Unknow error. Platform unspported.


构建此模块需要使用pkg-config,在编译qt的时候加上参数-pkg-config,交叉编译时会必须指定-sysroot
报错信息:pkg-config is required.


官方资料:

On Linux, Clang or GCC version 5 or later is required. Supported configurations are linux-g++ and linux-clang. Qt WebEngine requires
pkg-config to detect most of its dependencies. The following
pkg-config files are required: dbus-1 fontconfig If Qt was configured
for xcb, the following pkg-config files are also required: libdrm
xcomposite xcursor xi xrandr xscrnsaver xtst Further, development
packages for khr and libcap need to be installed.

确保有32位设备的环境,否则使用-no-webengine-v8-snapshot参数编译
报错信息:“V8 snapshot cannot be built. Most likely, the 32-bit host compiler does not work.”
"Please make sure you have 32-bit devel environment installed, or "
“configure webengine with ‘-no-webengine-v8-snapshot’”


需要安装gperf,bison,flex,python2
不需要交叉编译,直接安装即可
报错信息:
“Required gperf could not be found.”
“Required bison could not be found.”
“Required flex could not be found.”
“A suitable version of python2 could not be found.”


再次检测pkg-config,确保已经安装了pkg-config
报错信息:Host pkg-config is required


需要交叉编译glibc,
报错信息:“A suitable version of libc could not be found. See:https://sourceware.org/bugzilla/show_bug.cgi?id=14898”)


需要khr,即需要mesa库
报错信息:“khronos development headers appear to be missing (mesa/libegl1-mesa-dev)”


另外,还需要以下3个库
交叉编译dbus
交叉编译fontconfig
交叉编译nss
报错信息:“A suitable version of $$package could not be found.”


最后,可能还需要xcb库

报错信息:"“Could not find all necessary libraries for qpa-xcb support”


  • 4
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 16
    评论
Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: linux-aarch64-gnu-g++ (arm64, CPU features: neon) Target compiler: gcc 6.3.1 Configuration: cross_compile use_gold_linker compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent dbus reduce_exports stl Build options: Mode ................................... release Optimize release build for size ........ no Building shared libraries .............. yes Using C standard ....................... C11 Using C++ standard ..................... C++14 Using ccache ........................... no Using gold linker ...................... yes Using new DTAGS ........................ yes Using precompiled headers .............. yes Using LTCG ............................. no Target compiler supports: NEON ................................. yes Build parts ............................ libs Qt modules and options: Qt Concurrent .......................... yes Qt D-Bus ............................... yes Qt D-Bus directly linked to libdbus .... no Qt Gui ................................. yes Qt Network ............................. yes Qt Sql ................................. yes Qt Testlib ............................. yes Qt Widgets ............................. yes Qt Xml ................................. yes Support enabled for: Using pkg-config ....................... yes udev ................................... no Using system zlib ...................... yes Qt Core: DoubleConversion ....................... yes Using system DoubleConversion ........ no GLib ................................... no iconv .................................. yes ICU .................................... no Tracing backend ........................ Logging backends: journald ............................. no syslog ............................... no slog2 ................................ no Using system PCRE2 ..................... no Qt Network: getifaddrs() ........................... yes IPv6 ifname ............................ yes libproxy ............................... no Linux AF_NETLINK ....................... yes OpenSSL ................................ yes Qt directly linked to OpenSSL ........ no OpenSSL 1.1 ............................ no DTLS ................................... yes SCTP ................................... no Use system proxies ..................... yes Qt Gui: Accessibility .......................... yes FreeType ............................... yes Using system FreeType ................ no HarfBuzz ............................... yes Using system HarfBuzz ................ no Fontconfig ............................. no Image formats: GIF .................................. yes ICO .................................. yes JPEG ................................. yes Using system libjpeg ............... yes PNG .................................. yes Using system libpng ................ no EGL .................................... no OpenVG ................................. no OpenGL: Desktop OpenGL ....................... no OpenGL ES 2.0 ........................ no OpenGL ES 3.0 ........................ no OpenGL ES 3.1 ........................ no OpenGL ES 3.2 ........................ no Vulkan ................................. no Session Management ..................... yes Features used by QPA backends: evdev .................................. yes libinput ............................... no INTEGRITY HID .......................... no mtdev .................................. no tslib .................................. no xkbcommon .............................. no X11 specific: XLib ................................. no EGL on X11 ........................... no QPA backends: DirectFB ............................... no EGLFS .................................. no LinuxFB ................................ yes VNC .................................... yes Mir client ............................. no Qt Sql: SQL item models ........................ yes Qt Widgets: GTK+ ................................... no Styles ................................. Fusion Windows Qt PrintSupport: CUPS ................................... no Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite2 ................................ no SQLite ................................. yes Using system provided SQLite ......... no TDS (Sybase) ........................... no Qt Testlib: Tester for item models ................. yes Qt SerialBus: Socket CAN ............................. yes Socket CAN FD .......................... yes Qt QML: QML network support .................... yes QML debugging and profiling support .... yes QML sequence object .................... yes QML list model ......................... yes QML XML http request ................... yes QML Locale ............................. yes QML delegate model ..................... yes Qt Quick: Direct3D 12 ............................ no AnimatedImage item ..................... yes Canvas item ............................ yes Support for Qt Quick Designer .......... yes Flipable item .......................... yes GridView item .......................... yes ListView item .......................... yes TableView item ......................... yes Path support ........................... yes PathView item .......................... yes Positioner items ....................... yes Repeater item .......................... yes ShaderEffect item ...................... yes Sprite item ............................ yes Qt Scxml: ECMAScript data model for QtScxml ...... yes Qt Gamepad: SDL2 ................................... no Qt 3D: Assimp ................................. yes System Assimp .......................... no Output Qt3D Job traces ................. no Output Qt3D GL traces .................. no Use SSE2 instructions .................. no Use AVX2 instructions .................. no Aspects: Render aspect ........................ yes Input aspect ......................... yes Logic aspect ......................... yes Animation aspect ..................... yes Extras aspect ........................ yes Qt 3D Renderers: OpenGL Renderer ........................ yes Qt 3D GeometryLoaders: Autodesk FBX ........................... no Qt Wayland Client ........................ no Qt Wayland Compositor .................... no Qt Bluetooth: BlueZ .................................. no BlueZ Low Energy ....................... no Linux Crypto API ....................... no WinRT Bluetooth API (desktop & UWP) .... no Qt Sensors: sensorfw ............................... no Qt Quick Controls 2: Styles ................................. Default Fusion Imagine Material Universal Qt Quick Templates 2: Hover support .......................... yes Multi-touch support .................... yes Qt Positioning: Gypsy GPS Daemon ....................... no WinRT Geolocation API .................. no Qt Location: Qt.labs.location experimental QML plugin . yes Geoservice plugins: OpenStreetMap ........................ yes HERE ................................. yes Esri ................................. yes Mapbox ............................... yes MapboxGL ............................. no Itemsoverlay ......................... yes QtXmlPatterns: XML schema support ..................... yes Qt Multimedia: ALSA ................................... no GStreamer 1.0 .......................... no GStreamer 0.10 ......................... no Video for Linux ........................ yes OpenAL ................................. no PulseAudio ............................. no Resource Policy (libresourceqt5) ....... no Windows Audio Services ................. no DirectShow ............................. no Windows Media Foundation ............... no Qt Tools: QDoc ................................... no Qt WebEngine: Embedded build ......................... yes Pepper Plugins ......................... no Printing and PDF ....................... no Proprietary Codecs ..................... no Spellchecker ........................... yes Native Spellchecker .................... no WebRTC ................................. no Use System Ninja ....................... no Geolocation ............................ yes WebChannel support ..................... yes Use v8 snapshot ........................ yes Kerberos Authentication ................ no Building v8 snapshot supported ......... yes Use ALSA ............................... no Use PulseAudio ......................... no Optional system libraries used: re2 .................................. no icu .................................. no libwebp, libwebpmux and libwebpdemux . no opus ................................. no ffmpeg ............................... no libvpx ............................... no snappy ............................... no glib ................................. no zlib ................................. yes minizip .............................. no libevent ............................. no jsoncpp .............................. no protobuf ............................. no libxml2 and libxslt .................. no lcms2 ................................ no png .................................. no JPEG ................................. no harfbuzz ............................. no freetype ............................. no x11 .................................. no Required system libraries: fontconfig ........................... no dbus ................................. no nss .................................. no khr .................................. no glibc ................................ yes Required system libraries for qpa-xcb: libdrm ............................... no xcomposite ........................... no xcursor .............................. no xi ................................... no xrandr ............................... no xtst ................................. no Note: Also available for Linux: linux-clang linux-icc
在进行QtWebEngine交叉编译时,需要做一些准备工作。 首先,确保已安装交叉编译工具链和相应的目标平台SDK。根据目标平台的特性和要求,选择合适的交叉编译工具链,并按照其官方文档进行安装和配置。 接下来,下载Qt的源代码,选择与目标平台兼容的版本。确保下载的源码文件包括QtWebEngine模块。 然后,在终端中进入Qt源码所在目录,并执行以下命令: 1. 创建一个用于构建Qt的目录,例如build: ``` mkdir build cd build ``` 2. 配置Qt的构建选项,指定交叉编译工具链和目标平台SDK路径: ``` ../configure -xplatform <cross-compiler-platform> -device <device-specification> -sysroot <path-to-target-SDK> ``` 其中,`<cross-compiler-platform>`是指交叉编译工具链的平台标识符,`<device-specification>`是目标设备的描述,`<path-to-target-SDK>`是目标平台SDK的路径。 例如,对于基于ARM架构的Linux系统,可以使用以下配置选项: ``` ../configure -xplatform linux-arm-gnueabi-g++ -device linux-rasp-pi3-g++ -sysroot <path-to-target-rasp-pi3-SDK> ``` 3. 执行构建命令,编译QtWebEngine模块: ``` make module-qtwebengine ``` 注意,由于QtWebEngine是一个庞大的模块编译时间可能会比较长。 完成编译后,您可以将生成的库文件和其他必要文件拷贝到目标设备上,并进行部署和测试。 需要注意的是,QtWebEngine有一些特殊的依赖项,如Chromium和某些第三方库。在交叉编译之前,请确保在目标平台上已经安装了这些依赖项,并进行了相应的配置。 以上就是QtWebEngine交叉编译的基本过程。希望能对您有所帮助。如有任何问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

泡沫o0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值