Qt Raspberry Pi Cross Compile



  • Hi,
    I cross compiled Qt5.12.0 with source code fixed for error. Compile is success and install too.

    My configure:
    ./configure -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=$RPI_TOOLCHAIN -sysroot $RPI_SYSROOT -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -skip wayland -skip qtscript

    I could not see any files in /usr/local/qt5pi in my host machine, but in mounted image the files are present.

    Attched for qmake search output

    [0_1546051174894_qmakeSrch.txt](Uploading 100%)



  • @Kanni1303 said in Qt Raspberry Pi Cross Compile:

    I could not see any files in /usr/local/qt5pi in my host machine, but in mounted image the files are present.

    Good news! that's expected, isn't it?

    For instance if you followed this guide, after the build is done and doing make install (end of step #10) all the cross-compiled Qt related files reside in <WHATEVER/PATH/TO>/raspi/qt5pi in the host machine. Then you need to transfer the contents of that folder to the RPi device



  • @Pablo-J.-Rogina Yes the I can unmount image and install in my pi device, but in my host machine where I will config the Qt kit (qmake and compiler) ...???



  • @Kanni1303

    I guess you might have run into the same problem:

    /home/myhomeismycastle/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -c -include .pch/Qt5Core -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/myhomeismycastle/raspi/sysroot -O3 -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -Wvla -Wno-missing-field-initializers -D_REENTRANT -fPIC -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -I. -Iglobal -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty/forkfd -I../3rdparty/tinycbor/src -I../../include -I../../include/QtCore -I../../include/QtCore/5.12.0 -I../../include/QtCore/5.12.0/QtCore -I.moc -I.tracegen -I../3rdparty/pcre2/src -I/home/myhomeismycastle/raspi/sysroot/usr/include/glib-2.0 -I/home/myhomeismycastle/raspi/sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I../../mkspecs/devices/linux-rasp-pi3-g++ -o .obj/qendian.o global/qendian.cpp
    In file included from global/qendian.cpp:41:0:
    global/qendian.h:165:61: error: redeclaration ‘constexpr T qbswap(T) [with T = qfloat16]’ differs in ‘constexpr’
     template <> inline qfloat16 qbswap<qfloat16>(qfloat16 source)
                                                                 ^
    global/qendian.h:96:42: error: from previous declaration ‘constexpr T qbswap(T) [with T = qfloat16]’
     template <typename T> Q_DECL_CONSTEXPR T qbswap(T source);
                                              ^
    global/qendian.h:170:52: error: redeclaration ‘constexpr T qbswap(T) [with T = float]’ differs in ‘constexpr’
     template <> inline float qbswap<float>(float source)
                                                        ^
    global/qendian.h:96:42: error: from previous declaration ‘constexpr T qbswap(T) [with T = float]’
     template <typename T> Q_DECL_CONSTEXPR T qbswap(T source);
                                              ^
    global/qendian.h:175:55: error: redeclaration ‘constexpr T qbswap(T) [with T = double]’ differs in ‘constexpr’
     template <> inline double qbswap<double>(double source)
                                                           ^
    global/qendian.h:96:42: error: from previous declaration ‘constexpr T qbswap(T) [with T = double]’
     template <typename T> Q_DECL_CONSTEXPR T qbswap(T source);
                                              ^
    Makefile:11849: recipe for target '.obj/qendian.o' failed
    make[2]: *** [.obj/qendian.o] Error 1
    make[2]: Leaving directory '/home/myhomeismycastle/raspi/qt-everywhere-src-5.12.0/qtbase/src/corelib'
    Makefile:224: recipe for target 'sub-corelib-make_first' failed
    make[1]: *** [sub-corelib-make_first] Error 2
    make[1]: Leaving directory '/home/myhomeismycastle/raspi/qt-everywhere-src-5.12.0/qtbase/src'
    Makefile:48: recipe for target 'sub-src-make_first' failed
    make: *** [sub-src-make_first] Error 2
    

    I have tried to cross-compile the complete source of Qt 5.12.0 from archives, which did you cross-compile?

    I saw that you actually skip wayland, which is my reason for trying Qt 5.12.0. I still have issues using openGL on raspberry pi3 and I thought that I can fix only with latest Qt 5.12. Did you get as far yet?



  • Hi, I described the steps I followed in a post over here, https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/

    Some people found some issues and posted comments there, the “qendian” issue seems to be related to this bug, there is also a patch there.

    https://bugreports.qt.io/browse/QTBUG-71945