Hi,
I’m trying to cross compile OpenCV 4.3.0 with CUDA for Jetson Nano target. I already have OpenCV without CUDA cross compiled successfully, now having difficulty enabling CUDA support.
The problem I have is openCV cmake keeps giving me this error message, and I’m not sure which options to pass in: Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_INCLUDE_DIRS)
Here’s what I have installed on my host machine performing cross compilation:
-
cuda-toolkit-10-0 which gives me host nvcc and
/usr/local/cuda-10.0/targets/x86_64-linux
header files and libraries. -
cuda-cross-aarch64-10-0 which gives me
/usr/local/cuda-10.0/targets/aarch64-linux
header files and libraries.
This is the relevant options that I pass to OpenCV cmake:
cmake \
-DENABLE_NEON=OFF \
-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-10.0/bin/nvcc \
-DCUDA_HOST_COMPILER=/toolchain/linaro/bin/aarch64-linux-gnu-gcc \
-DCUDA_INCLUDE_DIRS=/usr/local/cuda-10.0/targets/aarch64-linux/include \
-DCUDA_CUDART_LIBRARY=/usr/local/cuda-10.0/targets/aarch64-linux/lib/libcudart.so \
-DCUDA_FAST_MATH=1 \
-DWITH_CUBLAS=ON \
-DWITH_CUDA=ON \
-DWITH_CUFFT=ON \
-DBUILD_CUDA_STUBS=OFF
When I add -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.0
option, I get this error message instead even though I have clearly provided CUDA_INCLUDE_DIRS
and CUDA_CUDART_LIBRARY
.
Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (found suitable version "10.0", minimum required is "6.5")
I have also applied FindCUDA.cmake from FindCUDA.cmake - Google Drive but still fails with the same error.
Any help is greatly appreciated.
Thanks.