Tried installing CUDA Toolkit 11.4, but CMake finds CUDA version 12.2

Hello, I am attempting to install CUDA Toolkit version 11.4. to target Jetson Orin Nano.

This is the download location I specified.

This is the install script it generates:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/sbsa/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.0-470.42.01-1_arm64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-4-local_11.4.0-470.42.01-1_arm64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

I then modify this for docker as a part of my larger docker build script:

RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/sbsa/cuda-ubuntu2004.pin
RUN mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
RUN wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.0-470.42.01-1_arm64.deb
RUN dpkg -i cuda-repo-ubuntu2004-11-4-local_11.4.0-470.42.01-1_arm64.deb
RUN apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub
RUN apt-get update
RUN apt-get -y install cuda

Then, I run the ROS Build script. The build runs, but fails near the end because OpenCV complains about finding CUDA 12.2 instead of the required CUDA 11.4:

isaac_ros_nitros_disparity_image_type, isaac_ros_nitros_image_type, isaac_ros_nitros_point_cloud_type]
Finished <<< isaac_ros_nitros_camera_info_type [2min 11s]
Starting >>> isaac_ros_nitros_detection2_d_array_type
Finished <<< isaac_ros_nitros_april_tag_detection_array_type [2min 15s]
Starting >>> isaac_ros_nitros_flat_scan_type
Finished <<< isaac_ros_nitros_compressed_image_type [2min 17s]
Starting >>> isaac_ros_nitros_imu_type
Finished <<< isaac_ros_nitros_disparity_image_type [2min 27s]
Starting >>> isaac_ros_nitros_occupancy_grid_type
Finished <<< isaac_ros_nitros_image_type [2min 31s]
Starting >>> isaac_ros_image_proc
Finished <<< isaac_ros_nitros_point_cloud_type [2min 32s]
Starting >>> isaac_ros_stereo_image_proc
— stderr: isaac_ros_stereo_image_proc
CMake Error at /usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find CUDA: Found unsuitable version “12.2”, but required is exact
version “11.4” (found /usr/local/cuda)

Call Stack (most recent call first):
/usr/local/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1268 (find_package_handle_standard_args)
/usr/lib/cmake/opencv4/OpenCVConfig.cmake:86 (find_package)
/usr/lib/cmake/opencv4/OpenCVConfig.cmake:108 (find_host_package)
/opt/ros/humble/install/share/image_geometry/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
/opt/ros/humble/install/share/image_geometry/cmake/image_geometryConfig.cmake:41 (include)
/opt/ros/humble/install/share/ament_cmake_auto/cmake/ament_auto_find_build_dependencies.cmake:67 (find_package)
CMakeLists.txt:26 (ament_auto_find_build_dependencies)


Failed <<< isaac_ros_stereo_image_proc [7.63s, exited with code 1]
Aborted <<< isaac_ros_image_proc [16.9s]
Aborted <<< isaac_ros_nitros_detection2_d_array_type [2min 9s]
Aborted <<< isaac_ros_nitros_imu_type [2min 7s]
Aborted <<< isaac_ros_nitros_flat_scan_type [2min 11s]
Aborted <<< isaac_ros_nitros_occupancy_grid_type [2min 1s]

Summary: 16 packages finished [6min 25s]
1 package failed: isaac_ros_stereo_image_proc
5 packages aborted: isaac_ros_image_proc isaac_ros_nitros_detection2_d_array_type isaac_ros_nitros_flat_scan_type isaac_ros_nitros_imu_type isaac_ros_nitros_occupancy_grid_type
2 packages had stderr output: isaac_ros_image_proc isaac_ros_stereo_image_proc
7 packages not processed
The command ‘/bin/bash -c . /opt/ros/$ROS_DISTRO/install/setup.sh && colcon build --merge-install --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release’ returned a non-zero code: 1

I noticed that the CUDA Toolkit 11.4 has an option to target aarch64-sbsa, but does not have a direct option for aarch64-jetson. I do not know if this is related to the failure.

thankyou for your help!

What OS and Jetson are you setting this up on? CUDA 11.4 runtime and toolkit should be installed by default with Jetpack 5.1.1. After the line “sudo apt-get -y install cuda”, could you run “apt-cache policy cuda” and “apt-cache depends cuda”? It is possible that CUDA 12.2 gets installed by default for you which causes the later issues. Have you tried the Isaac ROS Dev Docker image by any chance through isaac_ros_common/run_dev.sh?