0

I am trying to compile the qt6 for embedded linux (arm). I set the following configuration:

  1. Cmake : 3.22.1
  2. Toolchain: cc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf
  3. path to my rootfs: /home/manra/rootfs/mysysroot
  4. my toolchain.make
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(TARGET_SYSROOT /home/manra/rootfs/perospheresysroot)
set(CROSS_COMPILER /home/manra/toolchain8/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf)
#set(CROSS_COMPILER /home/manra/toolchain9/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf)

# specify the cross compiler
set(CMAKE_C_COMPILER ${CROSS_COMPILER}/bin/arm-none-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/bin/arm-none-linux-gnueabihf-g++)
#set(CMAKE_LIBRARY_PATH /home/manra/rootfs/mysysroot/usr/lib/arm-linux-gnueabihf)
set(CMAKE_LIBRARY_PATH /home/manra/rootfs/mysysroot)

# where is the target environment
set(CMAKE_FIND_ROOT_PATH ${TARGET_SYSROOT})
set(CMAKE_SYSROOT ${TARGET_SYSROOT})

# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
  1. The configuration line used
./configure -confirm-license -commercial -prefix /usr/local/qt6 -extprefix ~/imx6/qt6 -device linux-imx6-g++ -sysroot ~/rootfs/perospheresysroot -nomake examples -nomake tests -skip webkit -skip assistant-webkit -skip qtwebengine -skip qt3d -skip qtwayland -skip qtandroidextras -skip qtcanvas3d -- -DCMAKE_TOOLCHAIN_FILE=/home/manra/qt6/qt5/toolchain.cmake -DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON

The problem: When I try to build, the object files that are part of the rootfs are not found.

arm-none-linux-gnueabihf/bin/ld: cannot find **crt1.o: No such file or directory**

However, looking to one of the subdirectories of my rootfs the crt1.o is there:

''' find . -name crt1.o ./usr/lib/arm-linux-gnueabihf/crt1.o '''

I also tried to add the full directory path to "LIBRARY" path without success. I really do not know what is wrong.

user1657666
  • 351
  • 2
  • 9

1 Answers1

0

This looks wrong to me...

set(CMAKE_LIBRARY_PATH /home/manra/rootfs/mysysroot)

I would have expected to see something more like this instead:

set(CMAKE_SYSTEM_PREFIX_PATH /home/manra/rootfs/mysysroot/usr /usr)
set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)

The CMAKE_LIBRARY_PATH variable is meant to be set internally by the project. The CMAKE_SYSTEM_LIBRARY_PATH variable is the toolchain equivalent, but is intended for special scenarios that CMAKE_SYSTEM_PREFIX_PATH alone cannot support.

Similarly, I think you're probably missing a /usr suffix here:

set(CMAKE_FIND_ROOT_PATH ${TARGET_SYSROOT}/usr)
set(CMAKE_SYSROOT ${TARGET_SYSROOT}/usr)

I haven't tested this myself, so no guarantees that it will work, but it was too long to be a comment.

Alex Reinking
  • 16,724
  • 5
  • 52
  • 86