FS#71467 - NVCC Segfaults when compiling OpenCV with Contrib

Attached to Project: Arch Linux
Opened by Alexander Mai (halfpotato) - Thursday, 08 July 2021, 01:19 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Tuesday, 12 October 2021, 22:41 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Felix Yan (felixonmars)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
NVCC Segfaults when compiling OpenCV when using gcc-11.1 and g++-11.1.

Additional info:
* g++ and gcc 11.1

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Mar_21_19:15:46_PDT_2021
Cuda compilation tools, release 11.3, V11.3.58
Build cuda_11.3.r11.3/compiler.29745058_0

Steps to reproduce:
Download OpenCV 4.5.3 and OpenCV Contrib 4.5.3. (https://github.com/opencv/opencv/releases/tag/4.5.3, https://github.com/opencv/opencv_contrib/releases)
Execute:
```
export library=`python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))"`
export default_exec=`which python3.9`
export python_exec=`which python`
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.3/modules -D PYTHON_EXECUTABLE=$python_exec -D PYTHON_DEFAULT_EXECUTABLE=$default_exec -D PYTHON_INCLUDE_DIRS=$include_dir -D PYTHON3_LIBRARY=$library -D BUILD_EXAMPLES=ON ..
make
```
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Tuesday, 12 October 2021, 22:41 GMT
Reason for closing:  Fixed
Additional comments about closing:  Seems fixed now. At any rate, we can't really fix this as nvcc is a closed source blob.
Comment by loqs (loqs) - Thursday, 08 July 2021, 22:04 GMT
 FS#70919  gcc 11 is not currently usable as the CUDA host compiler.
Comment by Sven-Hendrik Haase (Svenstaro) - Saturday, 28 August 2021, 20:44 GMT
Does this still occur with current CUDA?
Comment by Alexander Mai (halfpotato) - Monday, 30 August 2021, 20:55 GMT
Still happens on the latest CUDA: Build cuda_11.4.r11.4/compiler.30033411_0
Comment by loqs (loqs) - Monday, 30 August 2021, 21:59 GMT
Building opencv-cuda [1] without nvidia-sdk [2] in a clean chroot build completes. cuda-11.4.1-2 / gcc 11.1.0-1
[1] https://aur.archlinux.org/packages/opencv-cuda
[2] PKGBUILD.diff
[3] opencv-cuda-4.5.3-1-x86_64-build.log.xz
Comment by Sven-Hendrik Haase (Svenstaro) - Tuesday, 31 August 2021, 11:07 GMT
Wasn't the reporters problem that it doesn't work with opencv-contrib?
Comment by loqs (loqs) - Tuesday, 31 August 2021, 11:43 GMT
Does opencv-cuda not use opencv-contrib? It downloads the source in [1] and passes it to cmake in [2]. Is there something more that is needed to build with contrib?
Also looking through the build log I attached previously there are warnings from modules provided by contrib such as:
/build/opencv-cuda/src/opencv_contrib-4.5.3/modules/cudaoptflow/src/cuda/pyrlk.cu(1043): warning: function "tex2D(texture<T, 2, cudaReadModeElementType>, float, float) [with T=float]"

[1] https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=opencv-cuda#n24
[2] https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=opencv-cuda#n67

Loading...