Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE

I have using ubuntu:22.04 installed cuda 12.1 ,nvcc --version is working , now i m trying to build a docker image and getting isseu cuda misssing)

Errors << panoptic:cmake /home/catkin_ws/logs/panoptic/build.cmake.000.log
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find CUDA (missing: CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS
CUDA_CUDART_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindCUDA.cmake:1104 (find_package_handle_standard_args)
CMakeLists.txt:211 (find_package)

Hi, @jay.shah
Have you tried the library_path exports?

export LD_LIBRARY_PATH="/usr/local/cuda-12.1/lib64:$LD_LIBRARY_PATH"
export PATH="/usr/local/cuda-12.1/bin:$PATH"

Those exports are using the paths where my CUDA is installed, so I would suggest that you check in your case if they change. And finally to test if the exports worked you can then execute:

nvcc --version

If they do, I would advise to add them to ~/.bashrc, just add the two lines at the end of the file, so you don’t have to do do the exports every time you login.
If they don’t work you are better off doing a clean install in case something bad happened during the first install.

Regards,
Andres
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

hi NVIDIA

My code is containing cuda-10.2 dependency and i am having package installed cuda-12.1 , so can u provide the installation step for cuda-10.2

thanks

Hi @jay.shah ,
Have you tried using NVIDIA-docker?
It allows to use other CUDA versions on the same enviroment, have a look here. You can specify the CUDA and even the driver versions that you want on the container.

Regards,
Andres
Embedded SW Engineer at RidgeRun


this above pic contains the configuration ,which requires to install cuda-10.2

Hi NVIDIA

Let me explain the scenario :

Right now we have one Dockerfile where we wanted to execute our application that require 2thing jetson hardware and cuda library, now we already have running this Dockerfile on-premise server which is arm64 jetson hardware, we wanted to use AWS instance g5g.2xlarge to achieve the same.