Build opencv-dua on jetpack 5.0.2

my device is Jetson AGX Xavier, I install jetpack 5.0.2 on it, then I tried to build a docker image; the base image is nvcr.io/nvidia/l4t-tensorrt:r8.4.1-runtime, I tried to make install opencv-cuda(opencv4.6.0) in it, I met

CMake Warning at cmake/OpenCVFindLibsPerf.cmake:45 (message):
  OpenCV is not able to find/configure CUDA SDK (required by WITH_CUDA).

  CUDA support will be disabled in OpenCV build.

  To eliminate this warning remove WITH_CUDA=ON CMake configuration option.

Call Stack (most recent call first):
  CMakeLists.txt:733 (include)

the CMake built command is cmake \ -D WITH_CUDA=ON \ -D WITH_CUDNN=ON \ -D CUDA_ARCH_BIN="7.2,8.7" \ -D CUDA_ARCH_PTX="" \ -D BUILD_opencv_cudacodec=ON \ -D OPENCV_GENERATE_PKGCONFIG=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ -D WITH_GSTREAMER=ON \ -D WITH_LIBV4L=ON \ -D BUILD_opencv_python3=ON \ -D BUILD_TESTS=OFF \ -D BUILD_PERF_TESTS=OFF \ -D BUILD_EXAMPLES=OFF \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local .. \ && make -j$(nproc) install

I also tried -D CUDA_BIN_PATH=/usr/local/cuda \ -D CUDNN_INCLUDE_DIR=/usr/local/cuda/include \ -D CUDA_CUDA_LIBRARY=/usr/local/cuda/lib64/stubs/libcuda.so \, but it didn’t work

Try without backslashes:

cmake -D WITH_CUDA=ON  -D WITH_CUDNN=ON  -D CUDA_ARCH_BIN="7.2,8.7"  -D CUDA_ARCH_PTX=""  -D OPENCV_GENERATE_PKGCONFIG=ON  -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules  -D WITH_GSTREAMER=ON  -D WITH_LIBV4L=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE  -D CMAKE_INSTALL_PREFIX=/usr/local ..

The warning about cmake version should be harmless.
If it successfully completes the configuration, you would build and install:

make -j$(nproc)

# If 100% is built ok, install with:
sudo make install

yes, backslashes are in the docker image command,

If there is a newline after each backslash, it should be ok.
So does it successfully configures, builds and installs ?
Do you see any error further than the above warning ?

thanks for replying, when Cmake …,

i also tried here,but still couldnot find cuda

It might not be an opencv build script issue, but just a CUDA/CMake install issue that you’re hitting here.
Can another software configured by cmake find CUDA in your container ?

Did you launch docker with --runtime nvidia ?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.