Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Cannot cross-compile Qt5.15.0 on RaspberryPi4 because V8 Snapshot support keeps from configuring QtWebEngine properly



  • Hi!

    My system specs are:
    Host: Ubuntu 20.04 LTS
    Target: Raspberry Pi 4 with Raspbian GNU/Linux 10 Buster
    Compiler: GCC Linaro 7.4.1 2019.02 x86-64 Arm-Linux-Gnueabihf

    I'm cross compiling Qt5.15.0 on a Raspberry Pi 4 and I'm stuck when trying to configure QTWebEngine.
    I've used this guide to setup my environment and everything is fine when I configure everything else but QtWebEngine. (I tried compiling it and tested it on my device.)

    Every time I get this error:
    WARNING: V8 snapshot cannot be built. Most likely, the 64-bit host compiler does not work. Please make sure you have 32-bit devel environment installed.

    I've dug more into the issue and this is the error found in the config.log file:

    Checking for host compiler... 
    + cd /home/user/raspberrypi/build/config.tests/hostcompiler && PKG_CONFIG_SYSROOT_DIR=/home/user/raspberrypi/sysroot PKG_CONFIG_LIBDIR=/home/user/raspberrypi/sysroot/usr/lib/pkgconfig:/home/user/raspberrypi/sysroot/usr/share/pkgconfig:/home/user/raspberrypi/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /home/user/raspberrypi/build/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" -early "CONFIG += cross_compile" /home/user/raspberrypi/qt-everywhere-src-5.15.0/qtwebengine/config.tests/hostcompiler
    + cd /home/user/raspberrypi/build/config.tests/hostcompiler && MAKEFLAGS= /usr/bin/make
    > g++ -c -pipe -m32 -O2 -w -fPIC  -I/home/user/raspberrypi/qt-everywhere-src-5.15.0/qtwebengine/config.tests/hostcompiler -I. -I/home/user/raspberrypi/qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-g++ -o main.o /home/user/raspberrypi/qt-everywhere-src-5.15.0/qtwebengine/config.tests/hostcompiler/main.cpp
    > In file included from /home/user/raspberrypi/qt-everywhere-src-5.15.0/qtwebengine/config.tests/hostcompiler/main.cpp:29:
    > /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
    >    27 | #include <bits/libc-header-start.h>
    >       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
    > compilation terminated.
    > make: *** [Makefile:169: main.o] Error 1
    test config.qtwebengine_core.tests.webengine-host-compiler FAILED
    Done running configuration tests.
    

    I don't understand why g++ was called on my host if I provided a compiler with the appropriate sysroot that contains the files the test needs?

    Here is the options I passed to configure (I made a bash script):

    
    COMPILER_PATH=~/raspberrypi/tools/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf
    SYSROOT_PATH=~/raspberrypi/sysroot
    
    LDFLAGS="-L${SYSROOT_PATH}/lib/arm-linux-gnueabihf -L${COMPILER_PATH}/lib/ -L${COMPILER_PATH}/arm-linux-gnueabihf/lib/ -L${COMPILER_PATH}/arm-linux-gnueabihf/libc/usr/lib/ -L${COMPILER_PATH}/arm-linux-gnueabihf/libc/lib/ -L${SYSROOT_PATH}/lib -L${SYSROOT_PATH}/usr/lib -L${SYSROOT_PATH}/usr/lib/arm-linux-gnueabihf -L${SYSROOT_PATH}/lib/arm-linux-gnueabihf"
    
    ../qt-everywhere-src-5.15.0/configure \
    	-release \
    	-opensource -confirm-license \
    	-opengl es2 \
    	-eglfs \
    	-xcb \
    	-device linux-rasp-pi4-v3d-g++ \
    	-device-option CROSS_COMPILE=${COMPILER_PATH}/bin/arm-linux-gnueabihf- \
    	-sysroot ${SYSROOT_PATH} \
    	-prefix /usr/local/qt5pi \
    	-extprefix ~/raspberrypi/qt5pi \
    	-hostprefix ~/raspberrypi/qt5pi \
    	-skip qtscript \
    	-skip qtwayland \
    	-no-webengine-geolocation \
    	-nomake tests \
    	-nomake examples \
    	-make libs \
    	-pkg-config \
    	-no-use-gold-linker \
    	-v \
    	-recheck
    


  • Update:
    I tried a couple of things and read stuff on the web and i figured out how to enable or disable the feature.
    You just have to pass this to configure:
    (-no)-feature-webengine-v8-snapshot-support

    Enabling it just makes it so the configure fails so I'm gonna try to disable it and see what happens.

    Edit:
    This is the message shown as the configuration fails:
    ERROR: Feature 'webengine-v8-snapshot-support' was enabled, but the pre-condition '!config.unix || !features.cross_compile || arch.arm64 || tests.webengine-host-compiler' failed.



  • @JCRacine said in Cannot cross-compile Qt5.15.0 on RaspberryPi4 because V8 Snapshot support keeps from configuring QtWebEngine properly:

    ... pre-condition ...
    ... || arch.arm64 || ...

    Although I'm not well versed on Qt Webengine cross-compilation, from that error message I understand that you're missing a cross-compiler capable of ARM64 output



  • @Pablo-J-Rogina
    That seems like a problem since I'm using a 32bit Raspbian and I don't think the 64bit version is at a stable release yet?



  • @JCRacine said in Cannot cross-compile Qt5.15.0 on RaspberryPi4 because V8 Snapshot support keeps from configuring QtWebEngine properly:

    the 64bit version is at a stable release yet?

    Not yet that I know, but you may want to use Arch Linux ARM or Ubuntu OS which both provide 64 bit versions.



  • @Pablo-J-Rogina
    After thinking about it, I'm not sure if the "arch.arm64" condition refers to the host's arch of the target's?
    I know that the QMake variable for the host is QT_ARCH and the target is QT_TARGET_ARCH.
    Am I wrong to think that the condition refers to the host and not the target?



  • Update:
    Installing these packages seemed to have solved the issue with the 32 bit requirement for the host compiler, but I'm not sure if that will solve my problem or if it will work on my Raspberry Pi. I'm keeping you updated!!

    Installed via apt on Ubuntu:
    gcc-multilib g++-multilib libc6-dev-i386



  • Update:
    So that did the trick! Just one thing tho: chromium is built with Ninja by default, so if you don't specify the number of jobs for Ninja, be sure to have a LOT of RAM available. Alternatively. you can just use make -j# NINJAJOBS=-j# where # is the number of jobs max. I put 6 and still had to wait like ~3 hours to compile!


Log in to reply