Cross compile QtWebEngine for Raspberry Pi 4 - qt

I use qt-everywhere-src-5.15.0.tar.xz and gcc-linaro-7.4.1-2019.02-x86_64_arm-
linux-gnueabihf toolchain on an Ubuntu 18 to cross compile Qt and especially
QtWebEngine.
I use the following configure:
../qt-everywhere-src-5.15.0/configure \
-opengl es2 -device linux-rasp-pi4-v3d-g++ \
-device-option CROSS_COMPILE=~/raspi/tools/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- \
-sysroot ~/raspi/sysroot \
-prefix /usr/local/qt5pi \
-opensource -confirm-license -no-gbm \
-skip qtscript -skip qtandroidextras -skip qtcanvas3d \
-skip qtgamepad -skip qtmacextras -skip qtpurchasing \
-skip qtwinextras -skip qtx11extras \
-nomake tests -nomake examples -make libs \
-pkg-config -no-use-gold-linker -v
If I include "-skip qtwebengine" in the configure command, all the compilation works well, but when I include qtwebengine the configuration fails with the following warning:
WARNING: Could not find all necessary libraries for qpa-xcb support in QtWebEngine.
WARNING: QtWebEngine will not be built.
After searching a while, I know the reason for this warning. QtWebEngine uses
pkg-config, to get the required libraries (e.g. xtst, xcomposite, ...) and take
the libraries on my host system instead of using the copied packages from the raspberry.
How can I configure it, to use the copied files from the raspberry sysroot?

If the only libraries that seem to be missing are xtst, xcomposite, xi, etc. Those are located on the Pi in /usr/share. So your sysroot has to sync that folder as well.

Related

Ubuntu Cross-Compiling QT for Raspberry Pi | ERROR: Unknown command line option 'skip'

I am fairly very new to Ubuntu/Linux and am currently running into an issue with getting an ERROR: Unknown command not found. I am trying configure Qt for cross compilation for a raspberry pi. I have looked up for similar issues but to no avail unfortunately.
The code I am running is as follows
./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -qpa eglfs -no-xcb -system-freetype -skip qtwebengine -nomake examples -nomake tools -fontconfig
I need to skip a few things in it but when I run this I get this line
ERROR: Unknown command line option '-skip'.
For some extra info, this is my location when doing so as follows when typing in pwd
/home/usr/raspi/qt-everywhere-src-5.11.3/qtbase
Configure is not recognizing the skip option, because you are running it from qtbase folder. Try to tun configure from the top qt folder.

Can't qmake QtWebengine - "qtwebenginecore-config.pri: No such file or directory"

I built qt whit this configuration:
configure -v -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/doxa/raspi/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -opensource -confirm-license -sysroot /home/doxa/raspi/sysroot -make libs -nomake tests -nomake tools -nomake examples -skip qt3d -skip qtgamepad -skip qtlocation -skip qtsensors -skip qtwayland -skip qtdeclarative -prefix /usr/local/doxas_5.12.4 -extprefix /usr/local/doxas_5.12.4 -hostprefix /usr/local/doxas_5.12.4 -qpa xcb -no-use-gold-linker
Everything done well but, QtWebengine didn't configure.
Now I want to build and install this module(I did with Qt 5.7), but qmake returns an error:
doxa#K43SD:/media/doxa/MCBK/rpi_build/websss$ /media/doxa/MCBK/rpi_build/qtbase/bin/qmake /usr/local/Qt5.12.4/5.12.4/Src/qtwebengine/
Info: creating cache file /media/doxa/MCBK/rpi_build/websss/.qmake.cache
Cannot read /media/doxa/MCBK/rpi_build/websss/src/core/qtwebenginecore-config.pri: No such file or directory
Project ERROR: Could not find feature webengine-v8-snapshot-support.
doxa#K43SD:/media/doxa/MCBK/rpi_build/websss$
the *-config.pri is not available in the source of any module and it has to build during the module build process. I don't know how to generate this file. which tools of Qt should I use?
Qt: 5.12.4
Host: Ubuntu 18.04_x64
Thanks in advance
I Just found where is the problem.
I should use the out of source qmake, where it is installed.
Qt forum
mkdir build_qtwebengine
cd buid_qtwebengine
/path/to/your/cross_compiled_Qt/bin/qmake /path/to/qtwebengine

Building Qt with OpenSSL on Ubuntu 16.04.1 fails

I have almost spent a week trying to build Qt5.8.0 with OpenSSL on Ubuntu 16.04.1 x64.
First of all I downloaded sources of OpenSSL v1.0.2k. Then I configured it with command
./Configure --prefix=$PWD/dist -shared linux-x86_64
Then I run theese commands one by one:
make depend
make
make install
So I got Openssl installed in /home/user/openssl-OpenSSL_1.0.2k/dist
Then I downloaded Qt from official website, and installed it with sources, so the sources are situated in /home/user/Qt5.8.0/5.8/Src
Then I tried to configure it with command
OPENSSL_LIBS='-L/home/user/openssl-OpenSSL_1_0_2k/dist/lib -lssl -lcrypto' ./configure -prefix /home/user/qt5_static -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl-linked -I /home/user/openssl-OpenSSL_1_0_2k/dist/include/openssl -L /home/user/openssl-OpenSSL_1_0_2k/dist/lib
But got theese errors:
ERROR: Feature 'openssl' was enabled, but the pre-condition '!features.securetransport && tests.openssl' failed.
ERROR: Feature 'openssl-linked' was enabled, but the pre-condition
'features.openssl && libs.openssl' failed.
What am I doing wrong, and how to fix this issue?
Thank you in advance, and sorry for my bad english.
I had same problem when trying to link openSSL statically and found following solution:
1) Install openSSL
sudo apt-get update && sudo apt-get install libssl-dev
2) Configure and build qt from sources, including -openssl-linked option, my example configuration:
/home/someuser/Qt/5.8/Src/configure -c++std c++11 -static -release -platform linux-g++-64 -prefix /home/someuser/Qt/StaticRelease58 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -make libs -openssl-linked -nomake tools -nomake examples -nomake tests -opensource -confirm-license -skip qtwayland -skip qtwebview -skip qtwebengine -skip qtwebchannel -no-qml-debug
Note that to build QT statically, you also must have installed other packages described here:
http://doc.qt.io/qt-5/linux-requirements.html
http://doc.qt.io/qt-5/linux-deployment.html
P.S. Linking dynamically to openSSL from QT5.8 works fine for me with default setup.

An error building Qt libraries for the raspberry pi linking error

Is there anybody having this error while build qt libraries for raspberry pi 3 ?
/ssd/rpi/rpi-tools2/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld.gold: error: /ssd/rpi/tmp/qt-everywhere-opensource-src-5.7.0/qtbase/lib/libqtpcre.a(pcre16_chartables.o): unknown CPU architecture
I've read this link (https://stackoverflow.com/questions/13626726/an-error-building-qt-libraries-for-the-raspberry-pi#=) , but I can't find any clue on this.
This is what I'm trying..
On ubuntu 16.04, gcc 5.3.1,
mount jessie
sudo mount -o loop,offset=70254592 /ssd/rpi/2016-05-27-raspbian-jessie.img /mnt/rasp-pi-rootfs/
fix library paths
./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ /ssd/rpi/rpi-tools2/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc
export
export RPI_TOOLCHAIN=/ssd/rpi/rpi-tools2/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
export RPI_SYSROOT=/mnt/rasp-pi-rootfs
configure..
./configure -opengl es2 -c++std 11 -device linux-rpi3-g++ -fontconfig -device-option CROSS_COMPILE=$RPI_TOOLCHAIN -sysroot $RPI_SYSROOT -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt57pi -hostprefix /usr/local/qt57pi -v
make
make -j4
Run configure again with the parameter "-no-use-gold-linker".
The problem seems to be related to gold linker with ARMv8. I've changed one Makefile to test, changing "-fuse-ld=gold" to "-fuse-ld=bfd".
The link runs fine.
In qtbase/mkspecs/devices/linux-rpi3-vc4-g++/qmake.conf you can check the comments:
# Example configure command below. We disable using the GNU gold
# linker as it apparently has issues with ARMv8. In the configure
# output check that "EGLFS GBM .......... yes" is present, otherwise
# eglfs will not be functional.
#
# ./configure -release -opengl es2 -device linux-rpi3-vc4-g++ \
# -device-option CROSS_COMPILE=~/raspbian/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- \
# -sysroot ~/raspbian/sysroot \
# -prefix /usr/local/qt5pi -extprefix ~/raspbian/qt5pi -hostprefix ~/raspbian/qt5 \
# -v -nomake examples -nomake tests -no-use-gold-linker

How to build Qt5 with OpenSSL support

What is the correct configuration for building Qt5 with SSL support? I have currently compiled OpenSSL statically with VC2008 using the following command lines:
perl Configure VC-WIN32 --prefix=C:\Build-OpenSSL-VC-32
ms\do_ms
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
Configured Qt 5.3.1 with:
configure -developer-build -opensource -nomake examples -nomake tests -mp -confirm-license -opengl desktop -no-icu -skip qtserialport -skip qtwebkit-examples -platform win32-msvc2008 -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -I C:\Build-OpenSSL-VC-32\include -L C:\Build-OpenSSL-VC-32\lib
I get multiple linkage errors like
moc_qnetworkreply.obj : error LNK2001: unresolved external symbol "public: bool __thiscall QSslCertificate::operator==(class QSslCertificate const &)const " (??8QSslCertificate##QBE_NABV0##Z)
How to get the Qt to compile with OpenSSL support linked? What am I doing wrong?
OK finally I found that it is quite important to clean the configuration before reconfiguring. In previous versions of Qt nmake confclean did the trick but it seems it does not work anymore. According to QTBUG-34304 for now it is usefull to do git submodule foreach --recursive "git clean -dfx" instead of nmake confclean. After that a few more tweaks about gdi32.lib and user32.ilb were required to get the following configure line work:
configure -developer-build -opensource -nomake examples -nomake tests -mp -confirm-license -opengl desktop -no-icu -skip qtserialport -skip qtwebkit-examples -platform win32-msvc2008 -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -I C:\Build-OpenSSL-VC-32\include -L C:\Build-OpenSSL-VC-32\lib -L "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" -l Gdi32 -l User32
then
nmake
and VoilĂ .

Resources