# Build opencv with cuda error

**URL:** <https://forums.developer.nvidia.com/t/build-opencv-with-cuda-error/299837>\
**Category:** Jetson Orin NX\
**Tags:** opencv\
**Created:** [July 15, 2024, 9:21am UTC](https://forums.developer.nvidia.com/t/build-opencv-with-cuda-error/299837 "2024-07-15T09:21:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nxsf8023](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@nxsf8023](https://forums.developer.nvidia.com/u/nxsf8023)\
**Post date:** [July 15, 2024, 9:21am UTC](https://forums.developer.nvidia.com/t/build-opencv-with-cuda-error/299837/1 "2024-07-15T09:21:43Z")

</div>

I comipling the opencv 4.5.5 with cuda on my orin nx get error:

_ **CMake Error: The following variables are used in this project, but they are set to NOTFOUND.** _  
_ **Please set them or make sure they are set and tested correctly in the CMake files:** _  
_**CUDA\_cufft\_LIBRARY (ADVANCED)**_  
\*\*\* linked by target “opencv\_cudev” in directory /home/hbis/Downloads/opencv-4.5.5/opencv\_contrib/modules/cudev\*\*\*  
\*\*\* linked by target “opencv\_core” in directory /home/hbis/Downloads/opencv-4.5.5/modules/core\*\*\*  
\*\*\* linked by target “opencv\_cudaarithm” in directory /home/hbis/Downloads/opencv-4.5.5/opencv\_contrib/modules/cudaarithm\*\*\*

I use jetpack 6.0, the cuda ver is 12.2, here is my cmake :

cmake   
-D WITH\_CUDA=ON   
-D CUDA\_ARCH\_BIN=“8.7”   
-D CUDA\_cufft\_LIBRARY=/usr/local/cuda-12.2/lib64   
-D WITH\_cuDNN=ON   
-D OPENCV\_DNN\_CUDA=ON   
-D CUDA\_ARCH\_PTX=“”   
-D cuDNN\_VERSION=‘8.9’   
-D cuDNN\_INCLUDE\_DIR=‘/usr/include/’   
-D OPENCV\_GENERATE\_PKGCONFIG=ON   
-D OPENCV\_EXTRA\_MODULES\_PATH=/home/hbis/Downloads/opencv-4.5.5/opencv\_contrib/modules   
-D WITH\_GSTREAMER=ON   
-D WITH\_FFMPEG=ON   
-D WITH\_LIBV4L=ON   
-D BUILD\_opencv\_python3=ON   
-D BUILD\_opencv\_python2=OFF   
-D PYTHON\_EXECUTABLE=usr/bin/python3   
-D BUILD\_TESTS=OFF   
-D BUILD\_PERF\_TESTS=OFF   
-D BUILD\_EXAMPLES=OFF   
-DOPENCV\_DOWNLOAD\_MIRROR\_ID=gitcode   
-D CMAKE\_BUILD\_TYPE=RELEASE   
-D CMAKE\_INSTALL\_PREFIX=/usr/local   
…

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [July 16, 2024, 3:06am UTC](https://forums.developer.nvidia.com/t/build-opencv-with-cuda-error/299837/3 "2024-07-16T03:06:00Z")

</div>

Hi,

Does OpenCV 4.9.0 work for you?  
If yes, you can find below a script to build OpenCV on JetPack 6.0:

> [@如何使用GPU版OpenCV？](https://forums.developer.nvidia.com/t/gpu-opencv/293782/5):
>
> Hi, Here is the script for JetPack 6.0. [install\_opencv4.9.0\_Jetson.sh](https://forums.developer.nvidia.com/uploads/short-url/zDxI9fyMGjvgnarGpnGYNsS8mk2.sh) (2.7 KB) $ ./install\_opencv4.9.0\_Jetson.sh ... -- General configuration for OpenCV 4.9.0 ===================================== ... -- NVIDIA CUDA: YES (ver 12.2, CUFFT CUBLAS) -- NVIDIA GPU arch: 87 -- NVIDIA PTX archs: -- -- cuDNN: YES (ver 8.9.4) ... \*\* Install opencv 4.9.0 successfully \*\* Bye :) Test: $ python3 Python 3.10.12 (main, Nov 20 2023, 15:14:0…

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [August 14, 2024, 3:12am UTC](https://forums.developer.nvidia.com/t/build-opencv-with-cuda-error/299837/5 "2024-08-14T03:12:24Z")

</div>

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