Qt5.12.8的QtWebEngine库编译随笔(rk3588板卡)

kiki米米 2024-10-21 12:03:02 阅读 78

Qt5.12.8的QtWebEngine库编译随笔(rk3588板卡)

起因编译环境源码配置编译遇到问题

引用

起因

项目从rk3399板卡改为rk3588后原先的qtwebengine库直接无法使用了,故尝试在新的板卡下进行编译。

编译环境

板卡: rk3588

系统: unbuntu 20.04 LTS

gcc version: aarch64-linux-gnu 9.4.0

源码

下载地址:https://download.qt.io/new_archive/qt/5.12/5.12.8/single/

在这里插入图片描述

下载到板块后解压

<code>sudo tar -xf qt-everywhere-src-5.12.8.tar.xz

cd qt-everywhere-src-5.12.8

配置

由于配置的信息相当多,建议创建一个自动配置脚本,比如auto.sh,方便根据自己的系统进行参数调整。

sudo touch auto.sh

sudo chmod 755 auto.sh

sudo vim auto.sh

#auto.sh

./configure -prefix /root/honglingfeng/arm-qt-5.12.8 \

-opensource \

-confirm-license \

-release \

-strip \

-shared \

-optimized-qmake \

-c++std c++11 \

--rpath=no \

-pch \

-webengine-proprietary-codecs \

-skip qt3d \

-skip qtactiveqt \

-skip qtandroidextras \

-skip qtcanvas3d \

-skip qtconnectivity \

-skip qtdatavis3d \

-skip qtdoc \

-skip qtgamepad \

-skip qtlocation \

-skip qtmacextras \

-skip qtnetworkauth \

-skip qtpurchasing \

-skip qtremoteobjects \

-skip qtscript \

-skip qtscxml \

-skip qtsensors \

-skip qtspeech \

-skip qtsvg \

-skip qttools \

-skip qttranslations \

-skip qtwayland \

-skip qtwinextras \

-skip qtx11extras \

-skip qtxmlpatterns \

-skip qtgraphicaleffects \

-make libs \

-nomake tools \

-nomake tests \

-gui \

-widgets \

-dbus-runtime \

--glib=no \

--iconv=no \

--pcre=qt \

-qt-zlib \

-no-vulkan \

-no-openssl \

--freetype=qt \

--harfbuzz=qt \

-opengl es2 \

-xcb \

-xcb-xlib \

-egl \

-eglfs \

--pcre=qt \

-linuxfb \

-no-tslib \

-qt-libpng \

-qt-libjpeg \

--sqlite=qt \

具体configure参数解析可以参考以下文章:https://blog.csdn.net/qing666888/article/details/79597473

官方英文帮助文档: ./configure --help

注意:每次改变auto.sh里面的参数,记得将config.cache删除后在运行脚本

运行auto.sh脚本进行配置

因为缺少依赖文件,绝大部分情况下configure都无法通过的,即报WARNING: QtXXX will not be built.。所以必须要安装依赖文件,直到不报错为止。

root@ok3588:~/qtSource/qt-everywhere-src-5.12.8# sh auto.sh

+ cd qtbase

+ /root/qtSource/qt-everywhere-src-5.12.8/qtbase/configure -top-level -prefix /root/honglingfeng/arm-qt-5.12.8 -opensource -confirm-license -release -strip -shared -optimized-qmake -c++std c++11 --rpath=no -pch -webengine-proprietary-codecs -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtspeech -skip qtsvg -skip qttools -skip qttranslations -skip qtwayland -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -skip qtgraphicaleffects -make libs -nomake tools -nomake tests -gui -widgets -dbus-runtime --glib=no --iconv=no --pcre=qt -qt-zlib -no-vulkan -no-openssl --freetype=qt --harfbuzz=qt -opengl es2 -xcb -xcb-xlib -egl -eglfs --pcre=qt -linuxfb -no-tslib -qt-libpng -qt-libjpeg --sqlite=qt

Creating qmake...

.Done.

This is the Qt Open Source Edition.

You have already accepted the terms of the Open Source license.

Running configuration tests...

Checking for gold linker... yes

Checking for machine tuple... yes

Checking for valid makespec... yes

Checking for target architecture... arm64

Checking for alloca() in alloca.h... yes

Checking for C99 support... yes

Checking for C11 support... yes

Checking for new dtags support... yes

Checking for pkg-config... yes

Checking for D-Bus >= 1.2 (host)... yes

Checking for udev... yes

Checking for POSIX fallocate()... yes

Checking for precompiled header support... yes

Checking for RDRAND instruction... no

Checking for symbol visibility support... yes

Checking for -Bsymbolic-functions support... no

Checking for STL compatibility... yes

Checking for clock_gettime()... yes

Checking for POSIX monotonic clock... yes

Checking for C++11 <future>... yes

Checking for dlopen()... yes

Checking for eventfd... yes

Checking for futimens()... yes

Checking for getauxval()... yes

Checking for getentropy()... yes

Checking for GNU libc... yes

Checking for ICU... yes

Checking for inotify... yes

Checking for SysV IPC... yes

Checking for linkat()... yes

Checking for ppoll()... yes

Checking for renameat2()... yes

Checking for slog2... no

Checking for statx() in libc... yes

Checking for 64 bit atomics... yes

Checking for DoubleConversion... no

Checking for O_CLOEXEC... yes

Checking for C++11 <random>... yes

Checking for working std::atomic for function pointers... yes

Checking for getifaddrs()... yes

Checking for IPv6 ifname... yes

Checking for Linux AF_NETLINK sockets... yes

Checking for xkbcommon >= 0.5.0... yes

Checking for XCB >= 1.9... yes

Checking for atspi... yes

Checking for OpenGL ES 2.0... yes

Checking for KMS... yes

Checking for DRM Atomic API... yes

Checking for EGL... yes

Checking for XLib... yes

Checking for EGL on X11... yes

Checking for EGLDevice... yes

Checking for GBM... no

Checking for Mali EGL... no

Checking for Mali 2 EGL... no

Checking for i.Mx6 EGL... no

Checking for XCB Xlib... yes

Checking for evdev... yes

Checking for libinput... no

Checking for LinuxFB... yes

Checking for mtdev... no

Checking for OpenGL ES 3.0... yes

Checking for OpenGL ES 3.1... yes

Checking for OpenGL ES 3.2... yes

Checking for OpenVG... no

Checking for default QPA platform... xcb

Checking for XCB ICCCM >= 0.3.9... yes

Checking for XCB SHM... yes

Checking for XCB Image >= 0.3.9... yes

Checking for XCB Keysyms >= 0.3.9... yes

Checking for XCB RandR... yes

Checking for XCB XRender... yes

Checking for XCB Renderutil >= 0.3.9... yes

Checking for XCB Shape... yes

Checking for XCB Sync... yes

Checking for XCB Xfixes... yes

Checking for XCB Xinerama... yes

Checking for XCB (extensions)... yes

Checking for X11 prefix... /usr

Checking for X11 session management... yes

Checking for XCB XInput... yes

Checking for XCB XKB >= 1.10... yes

Checking for xkbcommon-x11... yes

Checking for CUPS... yes

Checking for DB2 (IBM)... no

Checking for InterBase... no

Checking for MySQL... no

Checking for OCI (Oracle)... no

Checking for ODBC... no

Checking for PostgreSQL... no

Checking for SQLite (version 2)... no

Checking for TDS (Sybase)... no

Checking for Socket CAN... yes

Checking for Socket CAN FD... yes

Checking for jasper... no

Checking for mng... no

Checking for tiff... yes

Checking for webp... no

Checking for C++14 make_unique()... no

Checking for Direct3D 12... no

Checking for ALSA... yes

Checking for Vivante GPU... no

Checking for GStreamer 1.0... no

Checking for GStreamer 0.10... no

Checking for Video for Linux... yes

Checking for OpenAL... no

Checking for PulseAudio >= 0.9.10... yes

Checking for libresourceqt5... no

Checking for alsa... yes

Checking for embedded... no

Checking for bison... yes

Checking for flex... yes

Checking for gperf... yes

Checking for host pkg-config... /usr/bin/pkg-config

Checking for linker supports -z noexecstack... yes

Checking for x11... yes

Checking for libdrm... yes

Checking for xcomposite... yes

Checking for xcursor... yes

Checking for xi... yes

Checking for xtst... yes

Checking for poppler-cpp... no

Checking for pulseaudio >= 0.9.10... yes

Checking for python2... /usr/bin/python2

Checking for d-bus... yes

Checking for fontconfig... yes

Checking for glib-2.0 >= 2.32.0... yes

Checking for glibc > 2.16... yes

Checking for jsoncpp... no

Checking for khr... yes

Checking for lcms2... no

Checking for libevent... no

Checking for libvpx... no

Checking for libwebp, libwebpmux and libwebpdemux... no

Checking for libxml2 and libxslt... no

Checking for minizip... no

Checking for system ninja... no

Checking for nss >= 3.26... yes

Checking for opus... no

Checking for protobuf... no

Checking for re2... no

Checking for snappy... no

Done running configuration tests.

Configure summary:

Build type: linux-g++ (arm64, CPU features: cx16 neon)

Compiler: gcc 9.4.0

Configuration: use_gold_linker compile_examples enable_new_dtags largefile neon precompile_header shared release c++11 concurrent dbus reduce_exports release_tools stl

Build options:

Mode ................................... release; optimized tools

Optimize release build for size ........ no

Building shared libraries .............. yes

Using C standard ....................... C11

Using C++ standard ..................... C++11

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 ................................... yes

Using system zlib ...................... no

Qt Core:

DoubleConversion ....................... yes

Using system DoubleConversion ........ no

GLib ................................... no

iconv .................................. no

ICU .................................... yes

Tracing backend ........................ <none>

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 ................................ no

Qt directly linked to OpenSSL ........ no

OpenSSL 1.1 ............................ no

DTLS ................................... no

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 ............... no

PNG .................................. yes

Using system libpng ................ no

EGL .................................... yes

OpenVG ................................. no

OpenGL:

Desktop OpenGL ....................... no

OpenGL ES 2.0 ........................ yes

OpenGL ES 3.0 ........................ yes

OpenGL ES 3.1 ........................ yes

OpenGL ES 3.2 ........................ yes

Vulkan ................................. no

Session Management ..................... yes

Features used by QPA backends:

evdev .................................. yes

libinput ............................... no

INTEGRITY HID .......................... no

mtdev .................................. no

tslib .................................. no

xkbcommon .............................. yes

X11 specific:

XLib ................................. yes

XCB Xlib ............................. yes

EGL on X11 ........................... yes

QPA backends:

DirectFB ............................... no

EGLFS .................................. yes

EGLFS details:

EGLFS OpenWFD ........................ no

EGLFS i.Mx6 .......................... no

EGLFS i.Mx6 Wayland .................. no

EGLFS RCAR ........................... no

EGLFS EGLDevice ...................... yes

EGLFS GBM ............................ no

EGLFS VSP2 ........................... no

EGLFS Mali ........................... no

EGLFS Raspberry Pi ................... no

EGLFS X11 ............................ yes

LinuxFB ................................ yes

VNC .................................... yes

Mir client ............................. no

XCB:

Using system-provided XCB libraries .. yes

XCB XKB .............................. yes

XCB XInput ........................... yes

Native painting (experimental) ....... no

GL integrations:

GLX Plugin ......................... no

EGL-X11 Plugin ..................... yes

Qt Sql:

SQL item models ........................ yes

Qt Widgets:

GTK+ ................................... no

Styles ................................. Fusion Windows

Qt PrintSupport:

CUPS ................................... yes

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

Further Image Formats:

JasPer ................................. no

MNG .................................... no

TIFF ................................... yes

Using system libtiff ................. yes

WEBP ................................... yes

Using system libwebp ................. no

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 Multimedia:

ALSA ................................... yes

GStreamer 1.0 .......................... no

GStreamer 0.10 ......................... no

Video for Linux ........................ yes

OpenAL ................................. no

PulseAudio ............................. yes

Resource Policy (libresourceqt5) ....... no

Windows Audio Services ................. no

DirectShow ............................. no

Windows Media Foundation ............... no

Qt WebEngine:

Embedded build ......................... no

Full debug information ................. no

Pepper Plugins ......................... yes

Printing and PDF ....................... yes

Proprietary Codecs ..................... yes

Spellchecker ........................... yes

Native Spellchecker .................... no

WebRTC ................................. yes

Use System Ninja ....................... no

Geolocation ............................ no

WebChannel support ..................... yes

Use v8 snapshot ........................ yes

Kerberos Authentication ................ no

Support qpa-xcb ........................ yes

Use ALSA ............................... yes

Use PulseAudio ......................... yes

Optional system libraries used:

re2 .................................. no

icu .................................. no

libwebp, libwebpmux and libwebpdemux . no

opus ................................. no

ffmpeg ............................... no

libvpx ............................... no

snappy ............................... no

glib ................................. yes

zlib ................................. no

minizip .............................. no

libevent ............................. no

jsoncpp .............................. no

protobuf ............................. no

libxml2 and libxslt .................. no

lcms2 ................................ no

png .................................. no

JPEG ................................. no

harfbuzz ............................. no

freetype ............................. no

Required system libraries:

fontconfig ........................... yes

dbus ................................. yes

nss .................................. yes

khr .................................. yes

glibc ................................ yes

Required system libraries for qpa-xcb:

x11 .................................. yes

libdrm ............................... yes

xcomposite ........................... yes

xcursor .............................. yes

xi ................................... yes

xtst ................................. yes

Note: Also available for Linux: linux-clang linux-icc

Note: -optimized-tools is not useful in -release mode.

Qt is now configured for building. Just run 'make'.

Once everything is built, you must run 'make install'.

Qt will be installed into '/root/honglingfeng/arm-qt-5.12.8'.

Prior to reconfiguration, make sure you remove any leftovers from

the previous build.

QWebEngine基础依赖

sudo apt-get install bison flex gperf libdus* dbus* libfontconfig1-dev fontconfig libnss3-dev python2 pkg-config

sudo apt-get install libicu-dev ninja-build

OpenGL相关依赖

sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev libegl1-mesa-dev freeglut* libgles* libglew*

xcb相关依赖

sudo apt-get install libx11-*

sudo apt-get install libx11*

sudo apt-get install libxcb-*

sudo apt-get install libxcb*

sudo apt-get install libxkbcommon-devsudo

sudo apt-get install libxkbcommon-x11-dev

sudo apt-get install libxcb-xinerama0-dev

sudo apt-get install libxcb-sync-dev

若报Could not find all necessary libraries for qpa-xcb support

建议再安装一遍依赖

sudo apt-get install bison build-essential gperf flex libasound2-dev\

libcups2-dev libdrm-dev libegl1-mesa-dev libnss3-dev libpci-dev\

libpulse-dev libudev-dev nodejs libxtst-dev gyp ninja-build\

libssl-dev libxcursor-dev libxcomposite-dev libxrandr-dev

QtWebEngine库大部分问题都是没有依赖库导致的,如果出错就安装相关的依赖库即可。

编译

make -j4

make install

这里要提一下QWebEngine使用了chromium-browser大部分功能,基本第三方库中的chromium都需要编译。rk3588板卡只有8g内存,需要添加10G swap虚拟内存空间来支持编译。不然容易编译中途因为内存耗尽而中断。

sudo mkdir /swapfile

sudo dd if=/dev/zero of=swapfile bs=1G count=10

sudo mkswap /swapfile

# 开启

sudo swapon /swapfile

# 查看是否启用

free -h #swap那一栏

遇到问题

build chromium错误

WARNING: C++14 support is required in order to build chromium.

WARNING: QtWebEngine will not be built.

可以通过安装chromium-brower解决

sudo apt update

sudo apt install chromium-browser

引用

1:【Qt编译】ARM环境 Qt5.14.2-QtWebEngine库编译 (完整版)https://blog.csdn.net/Monster_H7/article/details/137630448

2: 交叉编译 Qt5.12 armv8(aarch64) 带 WebEngine - NVIDIA JETSON TX2 https://www.cnblogs.com/zekexiao/p/17681933.html

3:【研究Qt webengine 模块编译】linux 交叉编译qt5.12的webengine模块成功的条件 https://liucjy.blog.csdn.net/article/details/104422691



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。