Couldn't find CUDA library root

I have Cuda Toolkit 12.2 setup on Jetson, as well as the drivers + the Cuda samples repo. When I run which nvcc and nvcc --version they show expected outputs:

/usr/local/cuda-12.2/bin/nvcc.

and

Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

The issue is when I try to compile the Cuda samples via cmake .., I get this error:

CMake Error at /cmake-3.21/Modules/CMakeDetermineCUDACompiler.cmake:212
Couldn't find CUDA library root.

I have looked at this post: Cmake cannot find CUDA when installed in local directory but my Cuda installation has remained the same (no updates).

The instructions for building the Cuda samples on the repo are simple and do not have extra steps.

I’ve tried:

  1. Creating + setting CUDA_HOME and CUDA_PATH env vars to usr/local/cuda-12.2
  2. Adding /usr/local/cuda-12.2/bin to PATH
  3. Following these Mandatory Steps in the Cuda Installation Guide: 1. Introduction — Installation Guide for Linux 12.8 documentation
  4. I’ve added the LD_LIBRARY_PATH variable via export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} as well.

Update:
I’ve looked into where the error is occurring: CMakeDetermineCUDACompiler.cmake:212, and it tries a bunch of if statements. The 1st checks if ${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvvm/libdevice exists, which evaluates to: /usr/local/cuda/nvvm/libdevice. But the nvvm dir does not exist… Does this mean it is missing required artifacts?

Issue resolved. It was missing the nvvm/ dir entirely and the NVVM library libnvvm.so. Now, I’m getting a different error when I make, that nvcc fatal : Unsupported GPU architecture 'compute_100.