These are the compilers in the DriveOS Toolchain Folder located at ~/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/toolchains/aarch64–glibc–stable-2022.03-1/bin
When compiling I get the Error, that the Compiler (which is specified in the Toolchain-V5L.cmake) is not a full path to a compiler, or when using those aarch64-buildroot-linux-gnu compilers, that the compiler are broken and cannot be used to build the project.
Therefore I switched to use the Compiler in ~/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs/bin which seems to be working.
I installed ros-noetic-ros-base with a QEMU environment in ~/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs
following the steps in the nvidia/dw-ros repo
My Toolchain looks like this. Which is also based on the nvidia/dw-ros repo, but with changes to the TOOLCHAIN, to match the folder structure of 6.0.x
set(CMAKE_SYSTEM_NAME Linux)
# Specify the cross compiler
set(TOOLCHAIN "$ENV{HOME}/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs")
# set(TOOLCHAIN "$ENV{HOME}/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/toolchains/armv5-eabi--glibc--stable-2020.08-1")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN}/bin/c++")
set(CMAKE_C_COMPILER "${TOOLCHAIN}/bin/cc")
# Targetfs path
set(ROS_SYSROOT "$ENV{HOME}/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs")
# Library paths
set(LD_PATH "${ROS_SYSROOT}/usr/lib/aarch64-linux-gnu")
set(LD_PATH_EXTRA "/lib/aarch64-linux-gnu")
# setup compiler for cross-compilation
set(CMAKE_CXX_FLAGS "-fPIC" CACHE STRING "c++ flags")
set(CMAKE_C_FLAGS "-fPIC" CACHE STRING "c flags")
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "shared linker flags")
set(CMAKE_MODULE_LINKER_FLAGS "" CACHE STRING "module linker flags")
set(CMAKE_EXE_LINKER_FLAGS "" CACHE STRING "executable linker flags")
set(CMAKE_FIND_ROOT_PATH ${ROS_SYSROOT})
# Set compiler flags
set(CMAKE_SHARED_LINKER_FLAGS "--sysroot=${CMAKE_FIND_ROOT_PATH} -L${LD_PATH} -L${LD_PATH_EXTRA} -Wl,-rpath,${LD_PATH} -Wl,-rpath,${LD_PATH_EXTRA} -Wl,-rpath,${LD_PATH} -Wl,-rpath,${LD_PATH_EXTRA} ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "--sysroot=${CMAKE_FIND_ROOT_PATH} -L${LD_PATH} -L${LD_PATH_EXTRA} -Wl,-rpath,${LD_PATH} -Wl,-rpath,${LD_PATH_EXTRA} -Wl,-rpath,${LD_PATH} -Wl,-rpath,${LD_PATH_EXTRA} ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "--sysroot=${CMAKE_FIND_ROOT_PATH} -L${LD_PATH} -L${LD_PATH_EXTRA} -Wl,-rpath,${LD_PATH} -Wl,-rpath,${LD_PATH_EXTRA} -Wl,-rpath,${LD_PATH_EXTRA} ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_C_FLAGS "-fPIC --sysroot=${CMAKE_FIND_ROOT_PATH} -fpermissive -g" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS "-fPIC --sysroot=${CMAKE_FIND_ROOT_PATH} -fpermissive -g" CACHE INTERNAL "" FORCE)
# Search for programs only in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search for libraries and headers only in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# set system default include dir
include_directories(BEFORE SYSTEM ${ROS_SYSROOT}/usr/include ${ROS_SYSROOT}/usr/include/aarch64-linux-gnu)
I still get errors when compiling, looking like this:
Scanning dependencies of target pcl_recorder_node
[ 66%] Building CXX object CMakeFiles/pcl_recorder_node.dir/src/PclRecorder.cpp.o
[ 66%] Building CXX object CMakeFiles/pcl_recorder_node.dir/src/main.cpp.o
[100%] Linking CXX executable /home/chrtuch/carla-ros-bridge/catkin_ws/devel_isolated/pcl_recorder/lib/pcl_recorder/pcl_recorder_node
/usr/bin/ld: skipping incompatible /home/chrtuch/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs/usr/lib/aarch64-linux-gnu/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /home/chrtuch/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs/usr/lib/aarch64-linux-gnu/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /lib/aarch64-linux-gnu/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /lib/aarch64-linux-gnu/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /home/chrtuch/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs/usr/lib/aarch64-linux-gnu/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /home/chrtuch/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs/usr/lib/aarch64-linux-gnu/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /lib/aarch64-linux-gnu/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /lib/aarch64-linux-gnu/libpthread.a when searching for -lpthread
/usr/bin/ld: /usr/lib/aarch64-linux-gnu/libuuid.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
BTW: I have a simlink /usr/lib/aarch64-linux-gnu to /home/chrtuch/nvidia/nvidia_sdk/DRIVE_OS_6.0.4_SDK_Linux_DRIVE_AGX_ORIN_DEVKITS/DRIVEOS/drive-linux/filesystem/targetfs/lib/aarch64-linux-gnu
What kind of error is this? I cant find a good answer on google, is it due to the lib beeing the wrong architecture or version? I dont know.
Thanks for looking into this.