Unable to link CUDA libraries with dw_ros

Please provide the following info (check/uncheck the boxes after creating this topic):
Software Version
DRIVE OS Linux 5.2.6
DRIVE OS Linux 5.2.6 and DriveWorks 4.0
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version
other

Target Operating System
Linux
QNX
other

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
1.7.1.8928
other

Host Machine Version
native Ubuntu 18.04
other

Hello,
We have been trying to integrate the sample Object Detection with dw_ros framework. The sample_object_detector_tracker sample works fine when run from the /usr/local/driveworks-3.5/samples/bin folder and CUDA libraries are linked to the executable

The problem arises when we try to cross-compile a custom executable using dw_ros tutorial. In the attached CMakeLists.txt, we try to find the cuda-libs package. In the cuda-libs config file, cudart library cant be found even though the path for cudart library is given in HINTS . This the error we get when building the custom executable.

-- catkin 0.7.29
-- BUILD_SHARED_LIBS is on
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Warning at /usr/local/driveworks-3.5/samples/3rdparty/shared/cuda-libs/cuda-libs-config.cmake:15 (message):
  Could not find cudart library.  Looked in
  /../lib;/../lib/stubs;/../lib64;/../lib64/stubs
Call Stack (most recent call first):
  CMakeLists.txt:23 (find_package)


CMake Error at CMakeLists.txt:23 (find_package):
  Found package configuration file:

    /usr/local/driveworks-3.5/samples/3rdparty/shared/cuda-libs/cuda-libs-config.cmake

  but it set cuda-libs_FOUND to FALSE so package "cuda-libs" is considered to
  be NOT FOUND.


-- Configuring incomplete, errors occurred!
See also "/home/agx-pegasus/ros_radar_driver_agx/build_isolated/nv_camera_multiple_new/CMakeFiles/CMakeOutput.log".
See also "/home/agx-pegasus/ros_radar_driver_agx/build_isolated/nv_camera_multiple_new/CMakeFiles/CMakeError.log".
Makefile:820: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
<== Failed to process package 'nv_camera_multiple_new': 
  Command '['/home/agx-pegasus/ros_radar_driver_agx/install_isolated/env.sh', 'make', 'cmake_check_build_system']' returned non-zero exit status 2

Reproduce this error by running:
==> cd /home/agx-pegasus/ros_radar_driver_agx/build_isolated/nv_camera_multiple_new && /home/agx-pegasus/ros_radar_driver_agx/install_isolated/env.sh make cmake_check_build_system

Command failed, exiting.

The cuda-libs-config.cmake file is attached for reference. We get Unable to find cudart library linkage error. The issue is similar with cublas and other CUDA related libraries
CMakeLists.txt (1.8 KB)
cuda-libs-config.cmake (1.0 KB)

Dear @user130505,
Could you confirm if you can cross compile DW samples with out any issue?

No issues with samples such as sample_camera which involves camera initialization. Object detection involves CUDA libraries, which fail to fetch the required CUDA libraries even though the definitions are found in the CMakeList. For example, at the end of building the package, like mentioned above, it says the given path to cuda-libs config file is present and is able to locate it but continues to say “not found”.

Hi, @user130505

I haven’t looked into your problem. But have you referred to the compilation of sample_object_detector_tracker to see if any clue on it?

Yes, as a matter of fact, I have looked into it and sample_object_detector_tracker works fine. We used a similar approach to compile object detection with ROS and it fails. Like I mentioned above, not able to link the CUDA libraries when doing cross-compiling with ROS. Any help would be great.

Dear @user130505,
I think CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES variable seems to be empty as per my understanding from log output. Could you check that first?