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

[Link error]Cross-Compiling QT 5.14.2 To RPi4 failed.



  • Hi Everyone,
    I want to develop QT app on RPi4 and I hope I can use the ssh to develop and test my app.
    According this guide https://wiki.qt.io/RaspberryPi2EGLFS and the comment on https://code.qt.io/cgit/qt/qtbase.git/tree/mkspecs/devices/linux-rasp-pi4-v3d-g++/qmake.conf?h=5.14.2.
    My host is ubuntu 19.10.
    The cross compiler is installed by APT.

    cpp-9-arm-linux-gnueabihf/eoan,now 9.2.1-9ubuntu2cross1 amd64 [installed,automatic]
    g++-9-arm-linux-gnueabihf/eoan,now 9.2.1-9ubuntu2cross1 amd64 [installed,automatic]
    gcc-9-arm-linux-gnueabihf-base/eoan,now 9.2.1-9ubuntu2cross1 amd64 [installed,automatic]
    gcc-9-arm-linux-gnueabihf/eoan,now 9.2.1-9ubuntu2cross1 amd64 [installed,automatic]
    

    I write the configuration command below,

    ./configure -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /home/lake/Qt/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/lake/Qt/raspi/qt5pi -v -no-use-gold-linker
    

    But I cannot link succeed, it always throw the error like the following,

    make[3]: Entering directory `/home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/tools/qmltime'
    arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/lake/Qt/raspi/sysroot -Wl,-O1 -Wl,--enable-new-dtags -Wl,-rpath,/usr/local/qt5pi/lib -Wl,-rpath-link,/home/lake/Qt/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/lake/Qt/raspi/sysroot/lib/arm-linux-gnueabihf -o qmltime .obj/qmltime.o   /home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/lib/libQt5Quick.so /home/lake/Qt/qt-everywhere-src-5.14.1/qtbase/lib/libQt5Gui.so /home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/lib/libQt5QmlModels.so /home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/lib/libQt5Qml.so /home/lake/Qt/qt-everywhere-src-5.14.1/qtbase/lib/libQt5Network.so /home/lake/Qt/qt-everywhere-src-5.14.1/qtbase/lib/libQt5Core.so -L/home/lake/Qt/raspi/sysroot/usr/lib/arm-linux-gnueabihf -lGLESv2 -lpthread   
    /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/lib/libQt5Qml.so: undefined reference to `log2@GLIBC_2.29'
    /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/lib/libQt5Qml.so: undefined reference to `pow@GLIBC_2.29'
    /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/lib/libQt5Qml.so: undefined reference to `exp@GLIBC_2.29'
    /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/lib/libQt5Qml.so: undefined reference to `log@GLIBC_2.29'
    collect2: error: ld returned 1 exit status
    make[3]: *** [qmltime] Error 1
    make[3]: Leaving directory `/home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/tools/qmltime'
    make[2]: *** [sub-qmltime-make_first] Error 2
    make[2]: Leaving directory `/home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative/tools'
    make[1]: *** [sub-tools-make_first] Error 2
    make[1]: Leaving directory `/home/lake/Qt/qt-everywhere-src-5.14.1/qtdeclarative'
    make: *** [module-qtdeclarative-make_first] Error 2
    

    It seems libQt5Qml.so is built by host libc (2.30), but when another library that link to libQt5Qml, it will go to use the libc from sysroot (or rpath?), but Raspberry Pi is only support to 2.28 so far.

    Package: libc6
    Version: 2.28-10+rpi1
    Priority: optional
    Section: libs
    Source: glibc
    Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
    Installed-Size: 9,198 kB
    Depends: libgcc1
    Recommends: libidn2-0 (>= 2.0.5~)
    Suggests: glibc-doc, debconf | debconf-2.0, libc-l10n, locales
    Conflicts: openrc (<< 0.27-2~)
    Breaks: hurd (<< 1:0.5.git20140203-1), libtirpc1 (<< 0.2.3), locales (<< 2.28), locales-all (<< 2.28), nocache (<< 1.1-1~), nscd (<< 2.28), r-cran-later (<< 0.7.5+dfsg-2)
    

    Could anyone help me or give me some suggestion? This problem is stuck me over 4 day....
    Thanks a lot.



  • I guess the problem is caused by that libQt5Qml.so be linked to host's libc (libstdc++ -> libm), but when other projects link to libQt5Qml.so, linker will go to reference --sysroot or -rpath specified path, and found the remote libc.
    I don't know why, does anyone have any idea?? Thanks.



  • I have the same problem with libQt5Qml.so. My host is Linux Ubuntu 20.04, Raspberry Pi 4. I try cross-compile Qt version 5.15.1. Have you dealt with this ?


Log in to reply