Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt cross compile raspberry pi zero 2
Forum Updated to NodeBB v4.3 + New Features

Qt cross compile raspberry pi zero 2

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 436 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Curby
    wrote on 4 Apr 2024, 17:33 last edited by
    #1

    I successfully cpompiled Qt for Pi 4 following the instructions.
    https://wiki.qt.io/Cross-Compile_Qt_6_for_Raspberry_Pi

    Since I use an Pi 2 Zero in my application I would like to cross compile for this device. The core uses the same instruction set as the Pi4 (armv8-a), bus has an 32bit OS.

    Can I use aarch64-linux-gnu or does it have to be another compiler (arm-linux-gnueabihf)?

    I changed -DQT_QMAKE_TARGET_MKSPEC devices/linux-rasp-pi3-g++ but configure failed - OpenGL Test failed.

    Did someone tried to crss compile for Pi Zero 2?

    R 1 Reply Last reply 4 Apr 2024, 21:48
    0
    • C Curby
      4 Apr 2024, 17:33

      I successfully cpompiled Qt for Pi 4 following the instructions.
      https://wiki.qt.io/Cross-Compile_Qt_6_for_Raspberry_Pi

      Since I use an Pi 2 Zero in my application I would like to cross compile for this device. The core uses the same instruction set as the Pi4 (armv8-a), bus has an 32bit OS.

      Can I use aarch64-linux-gnu or does it have to be another compiler (arm-linux-gnueabihf)?

      I changed -DQT_QMAKE_TARGET_MKSPEC devices/linux-rasp-pi3-g++ but configure failed - OpenGL Test failed.

      Did someone tried to crss compile for Pi Zero 2?

      R Offline
      R Offline
      Ronel_qtmaster
      wrote on 4 Apr 2024, 21:48 last edited by
      #2

      @Curby HI. to compile for PI Zero 2 you will specify linux-rasp-pi2-g++ as your Device.
      When i tried cross compilation for pi 3, i used arm-linux-gnueabihf.Maybe it is also the case for pi2 here.Now if pi 2 Zero has an 32bit Os , you will need to use a 32bit compiler that can compile qt6.Hope it helps

      C 1 Reply Last reply 5 Apr 2024, 06:21
      0
      • R Ronel_qtmaster
        4 Apr 2024, 21:48

        @Curby HI. to compile for PI Zero 2 you will specify linux-rasp-pi2-g++ as your Device.
        When i tried cross compilation for pi 3, i used arm-linux-gnueabihf.Maybe it is also the case for pi2 here.Now if pi 2 Zero has an 32bit Os , you will need to use a 32bit compiler that can compile qt6.Hope it helps

        C Offline
        C Offline
        Curby
        wrote on 5 Apr 2024, 06:21 last edited by
        #3

        @Ronel_qtmaster But the Pi2 has a different core than the zero 2. How can that work?

        The top of my toolchain.cmake will look like this:

        cmake_minimum_required(VERSION 3.18)
        include_guard(GLOBAL)
        
        set(CMAKE_SYSTEM_NAME Linux)
        set(CMAKE_SYSTEM_PROCESSOR arm)
        
        set(TARGET_SYSROOT /home/nils/zero-sysroot)
        set(CMAKE_SYSROOT ${TARGET_SYSROOT})
        
        set(ENV{PKG_CONFIG_PATH} $PKG_CONFIG_PATH:/usr/lib/arm-linux-gnueabihf-gnu/pkgconfig)
        set(ENV{PKG_CONFIG_LIBDIR} /usr/lib/pkgconfig:/usr/share/pkgconfig/:${TARGET_SYSROOT}/usr/lib/arm-linux-gnueabihf-gnu/pkgconfig:${TARGET_SYSROOT}/usr/lib/pkgconfig)
        set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
        
        # if you use other version of gcc and g++ than gcc/g++ 9, you must change the following variables
        set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc-11)
        set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++-11)
        
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${TARGET_SYSROOT}/usr/include")
        set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
        
        set(QT_COMPILER_FLAGS "-march=armv8-a")
        set(QT_COMPILER_FLAGS_RELEASE "-O2 -pipe")
        set(QT_LINKER_FLAGS "-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed")
        
        1 Reply Last reply
        0

        1/3

        4 Apr 2024, 17:33

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved