0

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

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 then try

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

EDIT: the cmake toolchain-file I use is :

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()
jgnoss
  • 33
  • 5
  • »»No package 'libudev' found«« : Supposed to be the "package config file *libudev.pc* → `/usr/lib/arm-linux-gnueabihf/pkgconfig/libudev.pc` ← https://packages.debian.org/buster/armhf/libudev-dev/filelist – Knud Larsen Sep 18 '21 at 10:37
  • Yes, that file exists, and has the correct content. – jgnoss Sep 18 '21 at 13:21

1 Answers1

0

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})
jgnoss
  • 33
  • 5