# Issue compiling OpenCV 4.6.0 on top of cuda 11.5

**URL:** <https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614>\
**Category:** C++\
**Tags:** build, cuda\
**Created:** [March 30, 2023, 8:27pm UTC](https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614 "2023-03-30T20:27:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmarlborough](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rmarlborough](https://forum.opencv.org/u/rmarlborough)\
**Post date:** [March 30, 2023, 8:27pm UTC](https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614/1 "2023-03-30T20:27:10Z")

</div>

CMake Error at cuda\_compile\_1\_generated\_gpu\_mat\_nd.cu.o.Release.cmake:280 (message):  
Error generating file  
/home/rick/OpenCV/opencv-4.6.0/build/modules/core/CMakeFiles/cuda\_compile\_1.dir/src/cuda/./cuda\_compile\_1\_generated\_gpu\_mat\_nd.cu.o

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [March 31, 2023, 5:59am UTC](https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614/2 "2023-03-31T05:59:01Z")

</div>

Please post the full output from the CMake configuration stage, see

> [@'cv2.cuda.GpuMat' object has no attribute 'cols' when compiled from source](https://forum.opencv.org/t/cv2-cuda-gpumat-object-has-no-attribute-cols-when-compiled-from-source/12619):
>
> When I try to get cols and rows from CUDA GpuMat, pixel\_number = gray.cols \* gray.rows it results in error: AttributeError: 'cv2.cuda.GpuMat' object has no attribute 'cols' What is interesting is when I run this script using precompiled opencv-python & opencv-contrib-python 4.7.0, it never throws error. Only when I run it with OpenCV I compiled from source. Did I miss some options? My CMake command: CUDA\_PATH="/usr/local/cuda-11.4" CFLAGS="-I/usr/local/cuda-11.4/include -I/opt/intel/compil…

for an example.

---

<div class="post-metadata">

**Author:** ![rmarlborough](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rmarlborough](https://forum.opencv.org/u/rmarlborough)\
**Post date:** [April 3, 2023, 1:50pm UTC](https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614/3 "2023-04-03T13:50:25Z")

</div>

using …  
Ubuntu 22.04.1  
gcc 11.3.0  
cmake 3.22.1  
nvidia 525.89.02  
cuda 11.5  
cudnn 8

(Attachment CMakeLists.txt is missing)

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [April 3, 2023, 2:21pm UTC](https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614/4 "2023-04-03T14:21:03Z")

</div>

It looks like CUDA 11.5 doesn’t support gcc 11.3.0.  
[https://docs.nvidia.com/cuda/archive/11.5.1/cuda-installation-guide-linux/index.html](https://docs.nvidia.com/cuda/archive/11.5.1/cuda-installation-guide-linux/index.html)

This might not be the reason for your issue but its a good place to start.

---

<div class="post-metadata">

**Author:** ![rmarlborough](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rmarlborough](https://forum.opencv.org/u/rmarlborough)\
**Post date:** [April 3, 2023, 2:51pm UTC](https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614/5 "2023-04-03T14:51:56Z")

</div>

Hmm. These are both from the ubuntu repo. Shouldnt these have been verified?

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [April 3, 2023, 2:56pm UTC](https://forum.opencv.org/t/issue-compiling-opencv-4-6-0-on-top-of-cuda-11-5/12614/6 "2023-04-03T14:56:33Z")

</div>

Maybe they have, I’m only going off the docs. That said, and I am probably wrong here but, I can’t see a package manager refusing to install a package because you don’t have the version of gcc it requires, as you may install it at a later date.
