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

Qt5.15 Cross Compilation with Raspberry pi 4B failed



  • hello,
    I am trying to cross compile Qt 5.15 with target hardware Raspberry pi 4b referring from the below link
    https://github.com/UvinduW/Cross-Compiling-Qt-for-Raspberry-Pi-4
    i am getting this kind of error while executing make file

    code_./qt-everywhere-src-5.15.0/configure -release -opengl es2  -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=~/rpi/tools/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot ~/rpi/sysroot -prefix /usr/local/qt5.15 -extprefix ~/rpi/qt5.15 -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -make libs -pkg-config -no-use-gold-linker -v -recheck
    + cd qtbase
    + /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/configure -top-level -release -opengl es2 -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/home/ubuntu/rpi/tools/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/ubuntu/rpi/sysroot -prefix /usr/local/qt5.15 -extprefix /home/ubuntu/rpi/qt5.15 -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -make libs -pkg-config -no-use-gold-linker -v -recheck
    Performing shadow build...
    Preparing build tree...
    Creating qmake...
    g++ -c -o main.o   -std=c++11 -ffunction-sections -fdata-sections -g -g  -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/library -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/generators -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/src/3rdparty/tinycbor/src -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/generators/unix -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/generators/win32 -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/generators/mac -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/5.15.0 -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/5.15.0/QtCore -I../src/corelib/global -I/home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/mkspecs/linux-g++ -DQT_VERSION_STR=\"5.15.0\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=15 -DQT_VERSION_PATCH=0 -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/main.cpp
    In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/gthr-default.h:35,
                     from /usr/include/x86_64-linux-gnu/c++/9/bits/gthr.h:148,
                     from /usr/include/c++/9/ext/atomicity.h:35,
                     from /usr/include/c++/9/bits/basic_string.h:39,
                     from /usr/include/c++/9/string:55,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/../../src/corelib/text/qbytearray.h:52,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/qbytearray.h:1,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/../../src/corelib/text/qstring.h:50,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/qstring.h:1,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/../../src/corelib/io/qiodevice.h:50,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/include/QtCore/qiodevice.h:1,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/library/qmakevfs.h:34,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/library/qmakeparser.h:33,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/library/qmakeevaluator.h:36,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/project.h:32,
                     from /home/ubuntu/rpi/qt-everywhere-src-5.15.0/qtbase/qmake/main.cpp:30:
    /usr/include/c++/9/ext/concurrence.h:119:34: error: ‘__PTHREAD_SPINS’ was not declared in this scope
      119 |     __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
          |                                  ^~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/9/ext/concurrence.h:174:44: error: ‘__PTHREAD_SPINS’ was not declared in this scope
      174 |     __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
          |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    make: *** [Makefile:250: main.o] Error 1
    text
    

    I am unable to resolve what the issue is please help me out. Thanks in advance

    Regards
    Saicharan


  • Moderators

    It's including your host headers instead of ones coming from the toolchain. Maybe try using absolute path in your sysroot flag:

    -sysroot /home/yourUserName/rpi/sysroot
    

Log in to reply