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

Raspberry Pi 4 cross compile



  • Hi,

    when I tried configure Qt for cross compile (RaspberryPi 4)

    ./configure -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/home/jakub/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot /home/jakub/raspi/sysroot -opensource -confirm-license -skip qtwebengine -skip qtwayland -skip qtlocation -skip qtscript -make libs -prefix /usr/local/qt5pi -extprefix /home/jakub/raspi/qt5pi -hostprefix /home/jakub/raspi/qt5 -no-use-gold-linker -v -no-gbm
    

    I got error like:

    Project ERROR: Cannot run target compiler '/home/jakub/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++'. Output:
    ===================
    arm-linux-gnueabihf-g++: error: unrecognized argument in option '-mtune=cortex-a72'
    arm-linux-gnueabihf-g++: note: valid arguments to '-mtune=' are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a15 cortex-a5 cortex-a53 cortex-a7 cortex-a8 cortex-a9 cortex-m0 cortex-m0plus cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 cortex-r7 ep9312 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale
    Using built-in specs.
    

    My qmake.conf file:

    # qmake configuration for the Raspberry Pi 4 (32-bit) using the Mesa V3D
    # graphics stack. (not the Broadcom stack)
    #
    # This supports accelerated OpenGL both for X11 and DRM/KMS.  Perhaps
    # Wayland too.
    #
    # Tested with a sysroot created from Raspbian Buster and a gcc 7.4
    # toolchain from Linaro.
    #
    # Example configure command line, assuming installation to
    # /usr/local/qt5pi on device and ~/rpi/qt5 on the host:
    #
    # ./configure -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=~/rpi/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- \
    #   -sysroot ~/rpi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/rpi/qt5 -v
    #
    # Check the configure output carefully. EGLFS, EGLFS GBM, and EGL on X11
    # should all be 'yes'. Otherwise something is wrong.
    #
    # If getting linker errors like "undefined reference to `_dl_stack_flags'" check the
    # symlinks in the sysroot, they were probably not adjusted
    # correctly. F.ex. sysroot/usr/lib/arm-linux-gnueabihf/libpthread.so must point to
    # sysroot/lib/arm-linux-gnueabihf/libpthread.so.0. If it is a broken link instead, bad
    # things will happen.
    
    include(../common/linux_device_pre.conf)
    
    QMAKE_LIBS_EGL         += -lEGL
    QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL
    
    QMAKE_CFLAGS            = -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8
    QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS
    
    DISTRO_OPTS            += hard-float
    DISTRO_OPTS            += deb-multi-arch
    
    EGLFS_DEVICE_INTEGRATION = eglfs_kms
    
    include(../common/linux_arm_device_post.conf)
    
    load(qt_config)
    

    What should I do??
    I noticed that in qmake.conf file is a 32 bit configuration but in "./configure" commad I declared


  • Qt Champions 2019

    @Creatorczyk The compiler errors says that the compiler does not understand -mtune=cortex-a72, so remove -mtune=cortex-a72 from QMAKE_CFLAGS or change it to one understood by the compiler (it prints out what it understands).
    What compiler version do you use? Maybe you should use a newer compiler.



  • @jsulm I think I shouldn't remove "-mtune = cortex-a72" from qmake.conf , because it's configuration dedicated for RaspberryPi 4.

    Which compiler do you mean about update? On ubuntu, on Rpi4 or from tool folder?


  • Lifetime Qt Champion

    Hi,

    Then you have to update your compiler to a version that supports that mtune value.



  • @SGaist Are you talking about the compiler I chose in "./configure"?

    CROSS_COMPILE=/home/jakub/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
    

  • Lifetime Qt Champion

    Yes that one.



  • @SGaist @jsulm After updating the compiler, it worked. Thanks!!!!


Log in to reply