Please provide the following info (tick the boxes after creating this topic):
Software Version
DRIVE OS 6.0.5
DRIVE OS 6.0.4 (rev. 1)
DRIVE OS 6.0.4 SDK
other
Target Operating System
Linux
QNX
other
Hardware Platform
DRIVE AGX Orin Developer Kit (940-63710-0010-D00)
DRIVE AGX Orin Developer Kit (940-63710-0010-C00)
DRIVE AGX Orin Developer Kit (not sure its number)
other
SDK Manager Version
1.9.10816
other
Host Machine Version
native Ubuntu Linux 20.04 Host installed with SDK Manager
native Ubuntu Linux 20.04 Host installed with DRIVE OS Docker Containers
native Ubuntu Linux 18.04 Host installed with DRIVE OS Docker Containers
other
Hello,
I’m trying to cross compile my program using CMake, however for some reason I have an error when trying to compile simple program.
The toolchain is build as shown on NVidia site + some research on google.
I have tried to add -ldl
as many suggested, but it doesn’t help.
I’m trying to compile using docker which was suggested by NVidia advisers:
nvcr.io/drive/driveos-sdk/drive-agx-orin-linux-aarch64-sdk-build-x86:6.0.4.0-0004-patch-01
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- The CUDA compiler identification is NVIDIA 11.4.262
System is unknown to cmake, create:
Platform/linux to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/linux to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/linux to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
System is unknown to cmake, create:
Platform/linux to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: /usr/local/cuda-11.4/bin/nvcc
System is unknown to cmake, create:
Platform/linux to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Check for working CUDA compiler: /usr/local/cuda-11.4/bin/nvcc - broken
CMake Error at /usr/local/share/cmake-3.20/Modules/CMakeTestCUDACompiler.cmake:52 (message):
The CUDA compiler
"/usr/local/cuda-11.4/bin/nvcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /opt/imagry/aidriver_new/build2/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_7f85e/fast && /usr/bin/make -f CMakeFiles/cmTC_7f85e.dir/build.make CMakeFiles/cmTC_7f85e.dir/build
make[1]: Entering directory '/opt/imagry/aidriver_new/build2/CMakeFiles/CMakeTmp'
Building CUDA object CMakeFiles/cmTC_7f85e.dir/main.cu.obj
/usr/local/cuda-11.4/bin/nvcc -forward-unknown-to-host-compiler -ccbin=aarch64-linux-gnu-g++ -MD -MT CMakeFiles/cmTC_7f85e.dir/main.cu.obj -MF CMakeFiles/cmTC_7f85e.dir/main.cu.obj.d -x cu -c /opt/imagry/aidriver_new/build2/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_7f85e.dir/main.cu.obj
Linking CUDA executable cmTC_7f85e
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7f85e.dir/link.txt --verbose=1
/usr/bin/aarch64-linux-gnu-g++ CMakeFiles/cmTC_7f85e.dir/main.cu.obj -o cmTC_7f85e -lcudadevrt -lcudart_static -L"/usr/local/cuda-11.4/targets/aarch64-linux/lib/stubs" -L"/usr/local/cuda-11.4/targets/aarch64-linux/lib"
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /usr/local/cuda-11.4/targets/aarch64-linux/lib/libcudart_static.a(cudart_static.o): in function `__cudart112':
(.text+0x15b04): undefined reference to `dlclose'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /usr/local/cuda-11.4/targets/aarch64-linux/lib/libcudart_static.a(cudart_static.o): in function `__cudart113':
(.text+0x15ba0): undefined reference to `dlsym'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: (.text+0x19d0c): undefined reference to `dlsym'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: (.text+0x19d34): undefined reference to `dlsym'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: (.text+0x19d60): undefined reference to `dlsym'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: (.text+0x19d8c): undefined reference to `dlsym'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /usr/local/cuda-11.4/targets/aarch64-linux/lib/libcudart_static.a(cudart_static.o):(.text+0x19dbc): more undefined references to `dlsym' follow
My tool-chain file:
# the name of the target operating system
set(CMAKE_SYSTEM_NAME linux)
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
# which compilers to use for C and C++
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(ROS_SYSROOT /drive/drive-linux/filesystem/targetfs)
set(LD_PATH ${ROS_SYSROOT}/usr/lib/aarch64-linux-gnu /usr/local/cuda-11.4/lib/)
set(CMAKE_CUDA_COMPILER /usr/local/cuda-11.4/bin/nvcc)
set(CMAKE_CUDA_HOST_COMPILER aarch64-linux-gnu-g++)
# where is the target environment located
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu
/home/nvidia/build-linux-aarch64 ${ROS_SYSROOT})
set(CUDA_TOOLKIT_INCLUDE ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/include)
set(CUDA_CUDART_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/libcudart.so)
set(CUDA_cublas_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libcublas.so)
set(CUDA_cufft_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libcufft.so)
set(CUDA_nppc_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppc.so)
set(CUDA_nppial_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppial.so)
set(CUDA_nppicc_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppicc.so)
set(CUDA_nppicom_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppicom.so)
set(CUDA_nppidei_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppidei.so)
set(CUDA_nppif_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppif.so)
set(CUDA_nppig_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppig.so)
set(CUDA_nppim_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppim.so)
set(CUDA_nppist_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppist.so)
set(CUDA_nppisu_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppisu.so)
set(CUDA_nppitc_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppitc.so)
set(CUDA_npps_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnpps.so)nvironment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search headers and libraries in the target environment
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(THREADS_PTHREAD_ARG "0"
CACHE STRING "Result from TRY_RUN" FORCE)
set(CUDA_TARGET_CPU_ARCH ${CMAKE_SYSTEM_PROCESSOR})
set(CUDA_TARGET_OS_VARIANT "linux")
set(cuda_target_full_path ${CUDA_TARGET_CPU_ARCH}-${CUDA_TARGET_OS_VARIANT})
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda/)
set(cuda_target_full_path aarch64-linux)
set(CUDA_TOOLKIT_INCLUDE ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/include)
set(CUDA_CUDART_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/libcudart.so)
set(CUDA_cublas_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libcublas.so)
set(CUDA_cufft_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libcufft.so)
set(CUDA_nppc_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppc.so)
set(CUDA_nppial_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppial.so)
set(CUDA_nppicc_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppicc.so)
set(CUDA_nppicom_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppicom.so)
set(CUDA_nppidei_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppidei.so)
set(CUDA_nppif_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppif.so)
set(CUDA_nppig_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppig.so)
set(CUDA_nppim_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppim.so)
set(CUDA_nppist_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppist.so)
set(CUDA_nppisu_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppisu.so)
set(CUDA_nppitc_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnppitc.so)
set(CUDA_npps_LIBRARY ${CUDA_TOOLKIT_ROOT_DIR}/targets/${cuda_target_full_path}/lib/stubs/libnpps.so)
My cmakelists file:
The error occurs only when I add CUDA and a LANGUAGE
cmake_minimum_required(VERSION 3.20)
project(test_proj LANGUAGES C CXX CUDA)
Thanks!