本文主要是介绍Build qt5.15.0 qtwebengine on SUSE SLE-15,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. 目的。
qt4升级qt5之后,QString::toDouble方法不依赖于locale,导致很多欧洲国家(e.g.Germany,使用,作为小数点)转换有问题。 因此修改qt库,在QString::toDouble中直接调用QLocale的toDouble方法。仅仅编译qtbase (libQt5Core.so.5.15.0 不行,提示Qt5WebEngineCore), 以此也需要编译qtwebengine。
2. 准备环境。
2.1 查看README
因为Src/qtwebengine下没有README文件,所以,查看Src下的README文件,给出:
System requirements
------------------
- Perl 5.8 or later //当前版本为v5.26.1
- Python 2.7 or later // 当前版本为v2.7.17
- C++ compiler supporting the C++11 standard // 当前支持
For other platform specific requirements,
please see section “Setting up your machine” on:
http://wiki.qt.io/Get_The_Source
根据 README提示,进入https://doc.qt.io/qt-5/linux-requirements.html, 按照文档要求,检查以下依赖库是否全部安装(包含但不限于):
libxcb 1.11 libXrender libxcb-render libxcb-render-util libxcb-shape libxcb-randr libxcb-xfixes libxcb-sync libxcb-shm libxcb-icccm libxcb-keysyms libxcb-image libxkbcommon libxkbcommon-x11 libfontconfig libfreetype libXext libX11 libxcb libX11-xcb libSM libICE libglib-2.0 libpthread
libatspi opengl flite1-dev libspeechd-dev speech-dispatcher
关于 Qt WebEngine Dependencies https://doc.qt.io/qt-5/qtwebengine-platform-notes.html.
On all platforms, the following tools are required at build time:
Python 2.7.5 or later. Python 3 is not supported.
Bison, Flex
GPerf
Node.js for a full featured Dev Tools.
On Linux, Clang or GCC version 5 or later is required. Supported configurations are linux-g++, linux-clang and linux-clang-libc++
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.
2.2 查看chromium/doc/README.md
参考官方文档:
Checking out and building Chromium on Linux
https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_build_instructions.md
https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_open_suse_build_instructions.md
要求 64-bit 最低8GB内存最好16G以上(当前板子配置为 Intel 64-bit 4核 8G 内存, 配置较低,编译耗时较长,ninja编译过程中容易死机):
System requirements
64-bits: x86 builds are not supported on Linux.
Memory: >16GB is highly recommended.
Disk space: Expect a full checkout and build to take nearly 100GB.
Distribution: You should be able to build Chromium on any reasonably modern Linux distribution, but there are a lot of distributions and we sometimes break things on one or another. Internally, our development platform has been a variant of Ubuntu 14.04 (Trusty Tahr); we expect you will have the most luck on this platform.
chrome 官方给出的是Ubuntu的依赖库配置,其他发行版没有给出官方配置。
根据文档,yast安装以下依赖,有的已经装了,用yast检查一下:
pkg-config python perl bison flex gperf, mozilla-nss-devel glib2-devel gtk-devel wdiff lighttpd gcc gcc-c++ , mozilla-nspr mozilla-nspr-devel php5-fastcgi alsa-devel libexpat-devel , libjpeg-devel libbz2-devel
Note:
- wdiff 安装时提示依赖库,可以跳过去不依赖。
- gtk-deve 不确定装哪个,全部装了.
- php5-fastcgi找不到,装的是php7-fastcgi。
根据wiki,https://wiki.qt.io/Qt_5.15_Tools_and_Versions 针对SLES15 x86_64:
- OpenSSL 版本必须是1.1.1d,当前版本是1.1.0i, 需更新版本,为了不影响系统对1.1.0i的依赖,最好安装在指定目录,用的时候指定就可以。具体操作见博客
openssl库的编译安装-SUSE 15 - libclang 要求版本6.0, 当前为低版本,需从https://software.opensuse.org/explore上下载安装包。 由于不能relocate/prefix指定安装路径,只能装在默认路径下。
Software configurations for Qt 5.15.0
3. qmake生成makefile文件
由于qtwebengine 下没有configure 文件,执行 qmake qtwebengine.pro生成makefile.
或者在Src(上级目录)下 执行configure:
./configure --prefix=/optQt5.15.0/5.15.0/gcc_64 -I/home/ms1/workspace/tools/openssl/install-bak/include -L/home/ms1/workspace/tools/openssl/install-bak/lib -nomake examples -nomake tests -recheck-all
查看config.summary:
Use System Ninja ....................... yesUse System Gn .......................... noJumbo Build Merge Limit ................ 8Developer build ........................ noQtWebEngine required system libraries:fontconfig ........................... yesdbus ................................. yesnss .................................. yeskhr .................................. yesglibc ................................ yesOptional system libraries used:re2 .................................. yesicu .................................. nolibwebp, libwebpmux and libwebpdemux . yesopus ................................. yesffmpeg ............................... nolibvpx ............................... nosnappy ............................... yesglib ................................. yeszlib ................................. yesminizip .............................. yeslibevent ............................. yesjsoncpp .............................. yesprotobuf ............................. yeslibxml2 and libxslt .................. nolcms2 ................................ yespng .................................. noJPEG ................................. yesharfbuzz ............................. nofreetype ............................. yesxkbcommon ............................ no
Qt WebEngineCore:Embedded build ......................... noFull debug information ................. noPepper Plugins ......................... yesPrinting and PDF ....................... yesProprietary Codecs ..................... noSpellchecker ........................... yesNative Spellchecker .................... noWebRTC ................................. yesGeolocation ............................ yesWebChannel support ..................... yesKerberos Authentication ................ noExtensions ............................. yesSupport qpa-xcb ........................ yesUse ALSA ............................... yesUse PulseAudio ......................... yes
Qt WebEngineQml:Support Qt WebEngine Qml ............... yesUI Delegates ........................... yesTest Support ........................... no
Qt WebEngineWidgets:Support Qt WebEngine Widgets ........... yes
Qt PDF:Support V8 ............................. noSupport XFA ............................ noSupport XFA-BMP ........................ noSupport XFA-GIF ........................ noSupport XFA-PNG ........................ noSupport XFA-TIFF ....................... no
Qt PDF Widgets:Support Qt PDF Widgets ................. yes
4. 编译中遇到的问题:
- 编译到 ninja: Entering directory /opt/Qt5.15.0/Src/qtwebengine/src/core/release的时候莫名其妙死机,重启重新make仍然卡在这。
解决办法: 反复查看文档,Google官网关于chromium的和qt的关于qtwebengine的,检查哪些库没有安装,安装几个尝试再次build发现可以。 - 编译过程中,特别是编译到最后的时候,会出现死机,鼠标键盘不能用的情况,只能重启,有时候管用,有时候重启之后编译一个之后又死机,这是因为板子cup核数4低于ninja默认核数6, 这时需要-j 降低线程数,make -j 2 或者 make -j 3。
- 提示关于ninja的error.
检查ninja版本是否正确,最好在 qtwebengine/src/3rdparty/ninja 中用自带的ninja源码编译生成的 ninja.
如果直接使用开发板编译,建议将ninja编译使用cpu核心低于开发板核心(默认是用的6个核心,实际会根据硬件调整,如果默认值,遇到过死机情况)
Note
- 每次执行完qmake命令要删除config.cache, 清空缓存再执行qmake, 否则执行的结果还是上一次的.
这篇关于Build qt5.15.0 qtwebengine on SUSE SLE-15的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!