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

How to cross compile QtWebEngine



  • I am trying to cross compile Qt with qtWebengine. My host machine is x86_64 with Ubantu 16.04 and my target machine is iMX6. The version of Qt source code is 5.14. The tool chain is gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf. At first my configuration for Qt was set as follows:

    ./configure \
            -v \
            -prefix /opt/Qt5.14 \
            -xplatform linux-arm-gnueabihf-g++ \
            -opensource \
            -confirm-license \
            -pkg-config \
            -debug \
            -release \
            -shared \
            -strip \
            -qreal float \
            -make libs \
            -make tools \
            -pch \
            -printing-and-pdf \
            -no-sse2 \
            -no-sse3 \
            -no-rpath \
            -no-tslib \
            -no-opengl \
            -no-cups \
            -qt-zlib \
            -widgets \
            -skip qt3d \
            -skip qtcanvas3d \
            -nomake examples \
            -no-use-gold-linker \
    

    After configuration the warning information showed as follows:

    Note: The following modules are not being compiled in this configuration:
        webenginecore
        webengine
        webenginewidgets
    
    WARNING: Cross compiling without sysroot. Disabling pkg-config
    
    WARNING: A pkg-config support is required to build QtWebEngine.
    
    WARNING: QtWebEngine will not be built.
    

    It seems that cross compiling for qtwebengine requires pkg-config, and pkg-config requires sysroot. So I download sysroot offered with toolchain by Linaro and add option -sysroot to configuration. Then the warning information changed:

    ...
    
    Qt WebEngine Build Tools:
      Use System Ninja ....................... no
      Use System Gn .......................... no
      Jumbo Build Merge Limit ................ 8
      Developer build ........................ no
      QtWebEngine required system libraries:
        fontconfig ........................... no
        dbus ................................. no
        nss .................................. no
        khr .................................. no
        glibc ................................ yes
    
    ...
    
    Note: The following modules are not being compiled in this configuration:
        webenginecore
        webengine
        webenginewidgets
    
    WARNING: Disabling pkg-config since PKG_CONFIG_LIBDIR is not set and
    the host's .pc files would be used (even if you set PKG_CONFIG_PATH).
    Set this variable to the directory that contains target .pc files
    for pkg-config to function correctly when cross-compiling or
    use -pkg-config to override this test.
    
    WARNING: A pkg-config support is required to build QtWebEngine.
    

    Is there any tutorial about how to set pkg-config and QtWebEngine required system libraries?
    English is not my native language; please excuse typing errors.

    2020/2/23
    I recognized that pkg-config is a tool that is a little bit similar with cross-tool chain. So there is no need for cross compiling it for ARM board. All we have to do is install it on our host machine and specify the correct library address for it. Then the problem of pkg-config has been solved but the qtwebengine still not been compiled. It seems that some librarys like freetype and fontconfig are required. So I am trying to cross compile them. orz

    After cross compiling freetype, I cd qtwebengine and qmake -r, then new problems arise as Project ERROR: Unknown module(s) in QT: positioning. What's this mean? orz

    2020/2/24
    It seems that some instruction set is required for Qt5.14. However I could not find out what it is. So I turned to Qt5.9. After installation there was still no QtWebEngine. But when I cd to qtwebengine and use "qmake -r", the warning showed that I need fontconfig nss and dbus etc. Then I compiled fontconfig and nss successfully. But when I tried to compile dbus, there was a error showed as follows:

    /usr/include/glib-2.0/glib/gmacros.h:232:53: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
     #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
    

    It seems that wrong glib header is used. I have cross compiled glib for ARM and installed it to sysroot, then add -with-sysroot when configure dbus for making. But my compiler still uses wrong direction of glib. Have someone encountered this problem and could solve it?


Log in to reply