cross compile x86 to aarch64 nvidia jetson xavier nx

asked 2021-05-04 03:37:44 -0600

lior gravatar image

Hey, I have been trying to cross-compile from ubuntu18.04 to the jetson xavier NX now for almost 3 weeks. I’m new to cross compiling so i think i am lacking some knowledge. i have successfully created a image that can compile everything on the jetson xavier nx itself and have mounted its image file on my host system at the /mnt as a mount point.

i’m using cmake and the toolchain file i have configured so far is:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)

set(CMAKE_SYSTEM_PROCESSOR aarch64)

macro(find_host_program)
endmacro()

macro(find_host_package)
endmacro()

set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -isysroot /mnt -I /mnt/usr/include”)

set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc-8)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g+±8)

set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)

set(CMAKE_SYSROOT /mnt)
set(CMAKE_FIND_ROOT_PATH /mnt/usr/lib/aarch64-linux-gnu/cmake;/mnt/missioncontroller_mark2/ros2;/home/lioredis/dev_env/cross_compile_local/missioncontroller_mark2/ros2/build;/home/lioredis/dev_env/cross_compile_local/missioncontroller_mark2/ros2/install;/home/lioredis/mount_point/usr/lib/aarch64-linux-gnu)
set(CMAKE_INSTALL_RPATH /mnt/usr/lib/aarch64-linux-gnu)

set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(PYTHON_SOABI cpython-36m-aarch64-linux-gnu)
set(THREADS_PTHREAD_ARG “0” CACHE STRING “Result from TRY_RUN” FORCE)

some of my packages that i need to compile are successful while others encounter warnings followed by compiler errors which i can’t seem to solve. there seems to be some mismatch between the compiler and include libraries.

CMake Warning at /mnt/opt/ros/eloquent/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
Cannot generate a safe runtime search path for target pcl_conversions-test
because files in some directories may conflict with libraries in implicit
directories:

runtime library [libboost_system.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_filesystem.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_thread.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_date_time.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_iostreams.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_serialization.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_chrono.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_atomic.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libboost_regex.so.1.65.1] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libpcl_common.so.1.8] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libpcl_octree.so.1.8] in /mnt/usr/lib/aarch64-linux-gnu may be hidden by files in:
  /usr/lib/x86_64-linux-gnu
runtime library [libpcl_io.so.1.8 ...
(more)
edit retag flag offensive close merge delete