Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. cross compile QT6 configure -> packages not found
Forum Updated to NodeBB v4.3 + New Features

cross compile QT6 configure -> packages not found

Scheduled Pinned Locked Moved Solved Qt 6
8 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jgnoss
    wrote on last edited by
    #1

    I'm on a native bullseye machine
    building QT6.2 from git using the comiler and cross-compiler that comes packaged in bullseye

    first I build QT for the host using

    jgnoss@mav-dev:~/Devel/QT/qt_x86_64_build$ ../qt_git/configure -prefix /home/jgnoss/Devel/QT/qt_x86_64/6.2.0
    
    

    configure, build and install worked fine

    for cross-compile, I sshfs'd the targets rootfs to:
    /home/jgnoss/Devel/bbb/sysroot
    made a toolchain-file for cmake

    cmake_minimum_required(VERSION 3.18)
    include_guard(GLOBAL)
    
    set(CMAKE_SYSTEM_NAME Linux)
    set(CMAKE_SYSTEM_PROCESSOR arm)
    
    set(TARGET_SYSROOT /home/jgnoss/Devel/bbb/sysroot)
    set(CROSS_COMPILER /usr/arm-linux-gnueabihf)
    
    set(CMAKE_SYSROOT ${TARGET_SYSROOT})
    
    set(ENV{PKG_CONFIG_PATH} "")
    set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
    set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
    
    set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc-10)
    set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++-10)
    
    # set(QT_COMPILER_FLAGS "-march=armv7-a -mfpu=neon -mfloat-abi=hard")
    # set(QT_COMPILER_FLAGS "-march=armv7-a -mtune=cortex-a9 -mfpu=neon")
    #set(QT_COMPILER_FLAGS "-march=armv7-a -mfpu=neon")
    
    set(QT_COMPILER_FLAGS_RELEASE "-O2 -pipe")
    set(QT_LINKER_FLAGS "-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed")
    
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
    
    include(CMakeInitializeConfigs)
    
    function(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)
      if (_PREFIX MATCHES "CMAKE_(C|CXX|ASM)_FLAGS")
        set(CMAKE_${CMAKE_MATCH_1}_FLAGS_INIT "${QT_COMPILER_FLAGS}")
    
        foreach (config DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
          if (DEFINED QT_COMPILER_FLAGS_${config})
            set(CMAKE_${CMAKE_MATCH_1}_FLAGS_${config}_INIT "${QT_COMPILER_FLAGS_${config}}")
          endif()
        endforeach()
      endif()
    
      if (_PREFIX MATCHES "CMAKE_(SHARED|MODULE|EXE)_LINKER_FLAGS")
        foreach (config SHARED MODULE EXE)
          set(CMAKE_${config}_LINKER_FLAGS_INIT "${QT_LINKER_FLAGS}")
        endforeach()
      endif()
    
      _cmake_initialize_per_config_variable(${ARGV})
    endfunction()
    
    

    now in another directory y try to cross-compile for arm using

    jgnoss@mav-dev:~/Devel/QT/qt_bbb_build$  ../qt_git/configure -sysroot /home/jgnoss/Devel/bbb/sysroot -qt-host-path /home/jgnoss/Devel/QT/qt_x86_64/6.2.0 -prefix /home/jgnoss/Devel/QT/qt_bbb -extprefix /home/jgnoss/Devel/QT/qt_bbb -DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON -- -DCMAKE_TOOLCHAIN_FILE=/home/jgnoss/Devel/QT/toolchain-cross_armhf.cmake
    

    configure runs fine, but misses to detect packages/libraries that are installed on the target

    for example:
    output from configure

    -- Checking for module 'libudev'
    --   No package 'libudev' found
    

    running on target

    jgnoss@beaglebone:~$ dpkg -l |grep libudev
    ii  libgudev-1.0-0:armhf                      232-2                                 armhf        G
    Object-based wrapper library for libudev
    ii  libudev-dev:armhf                         241-7~deb10u8                         armhf        l
    ibudev development files
    ii  libudev1:armhf                            241-7~deb10u8                         armhf        l
    ibudev shared library
    
    jgnoss@beaglebone:~$ pkg-config --libs libudev
    -ludev
    
    

    that's just one example, there are a lot of packages/libraries that are not detected

    any ideas how to solve that?

    thanks
    Ju

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you install the dev packages of the dependencies on your target ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jgnoss
        wrote on last edited by
        #3

        @jgnoss said in cross compile QT6 configure -> packages not found:

        ii libudev-dev:armhf

        yes, that's the dev package

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jgnoss
          wrote on last edited by
          #4

          Is there a way to find out how configure is looking for libs and packages?

          like --debug-trycompile when checking for compiled stuff

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by SGaist
            #5

            AFAIK, cmake writes logs of its process. You should parse them.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jgnoss
              wrote on last edited by
              #6

              OK, found the quirk.

              Digging into configure logfiles it seemed configure isn't using pkg-config or at least not the right way.

              So I added -pkg-config to my configure options, but still no libraries/packages found.

              A closer look at pkg-config docs and cross compile options I came to conclusion that there is something wrong with where pck-config is looking for the .pc files.

              QT's example cmake language file at this page set some values for pkg-config that seems to be right, but it came out that it somehow conflicts with what configure internally does.

              Commenting out that following lines solved the problem and all libraries/packages where found.

              # set(ENV{PKG_CONFIG_PATH} "")
              # set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
              # set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
              
              1 Reply Last reply
              0
              • J Offline
                J Offline
                jgnoss
                wrote on last edited by
                #7

                Sorry forgot to mark the link to the cmake language file from qt

                here it is .

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jgnoss
                  wrote on last edited by
                  #8

                  and another sorry, it's the toolchain file, not the language file

                  1 Reply Last reply
                  0

                  • Login

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