Hi all I'm trying to crosscompile a ros2 package from an Ubuntu Jammy x86-64 host to an arm64v8 one. The build system is a wrapper on to cmake (full example at https://github.com/peppedxAlto/simplepackage).
I've created a sysroot, installed the aarch64-linux-gnu-g++ compiler and created a cmake toolchain file
#
# CMake Toolchain file for crosscompiling on ARM.
#
# Target operating system name.
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_CROSSCOMPILING TRUE)
if("$ENV{SYSROOT}" STREQUAL "" )
message(FATAL_ERROR "SYSROOT environment variables not defined !!!!")
endif()
# Name of C compiler.
set(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/aarch64-linux-gnu-g++")
# Where to look for the target environment. (More paths can be added here)
set(CMAKE_SYSROOT $ENV{SYSROOT})
set(CMAKE_FIND_ROOT_PATH $ENV{SYSROOT} )
set(CMAKE_INCLUDE_PATH /usr/include/aarch64-linux-gnu)
set(CMAKE_LIBRARY_PATH /usr/lib/aarch64-linux-gnu)
set(CMAKE_PROGRAM_PATH /usr/bin/aarch64-linux-gnu)
# Adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment only.
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search headers and libraries in the target environment only.
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# This assumes that pthread will be available on the target system
# (this emulates that the return of the TRY_RUN is a return code "0")
set(THREADS_PTHREAD_ARG "0"
CACHE STRING "Result from TRY_RUN" FORCE)
While this work for simple package as soon as i add a more involeved dependency I get
-- Configuring done
CMake Warning at CMakeLists.txt:15 (add_executable):
Cannot generate a safe runtime search path for target my_node because files
in some directories may conflict with libraries in implicit directories:
runtime library [libpython3.10.so] in /usr/lib/aarch64-linux-gnu may be hidden by files in:
/home/giellamo/roots/usr/lib/aarch64-linux-gnu
Some of these libraries may not be found correctly.
followed by
gmake[2]: *** No rule to make target '/usr/lib/aarch64-linux-gnu/libpython3.10.so', needed by 'my_node'. Stop.
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/my_node.dir/all] Error 2
in the host /usr/lib/aarch64-linux-gnu there is no libpython3.10, so I don't understand where this whole thing comes out.
Any suggestion?
`lrwxrwxrwx 1 giellamo giellamo 20 Feb 22 09:26 libpython3.10.so -> libpython3.10.so.1` It strangely works if i create a symlink in `/usr/lib/aarch64-linux-gnu` `sudo ln -s /home/giellamo/roots/usr/lib/aarch64-linux-gnu/libpython3.10.so` – PeppeDx Feb 22 '23 at 08:28