Ask Your Question
0

Building OpenCV with CUDA (Win10, VS 2017)

asked 2018-12-20 07:47:18 -0600

MxBx gravatar image

Hi, I am building OpenCV (4.0.0) with CUDA (10), TBB, MKL, VTK, Eigen on MS VIsual Studio 2017 (15.9.4) Evrything seems to work except that I get this error while building the INSTALL project in RELEASE mode. (I haven'T tried out the debug mode yet).

I get these four errors

54>c:\software\opencv\opencv\modules\core\include\opencv2\core\cuda\detail/color_detail.hpp(535): error : dynamic initialization is not supported for a __constant__ variable

54>c:\software\opencv\opencv\modules\core\include\opencv2\core\cuda\detail/color_detail.hpp(584): error : dynamic initialization is not supported for a __constant__ variable

54>c:\software\opencv\opencv\modules\core\include\opencv2\core\cuda\detail/color_detail.hpp(674): error : dynamic initialization is not supported for a __constant__ variable

54>c:\software\opencv\opencv\modules\core\include\opencv2\core\cuda\detail/color_detail.hpp(751): error : dynamic initialization is not supported for a __constant__ variable

from these four lines

(535) __constant__ float c_RGB2YUVCoeffs_f[5] = { B2YF, G2YF, R2YF, B2UF, R2VF };
(584) __constant__ float c_YUV2RGBCoeffs_f[5] = { U2BF, U2GF, V2GF, V2RF };
(674) __constant__ float c_RGB2YCrCbCoeffs_f[5] = {R2YF, G2YF, B2YF, YCRF, YCBF};
(751) __constant__ float c_YCrCb2RGBCoeffs_f[5] = {CR2RF, CR2GF, CB2GF, CB2BF};

I am kind of clueless how to deal with it. Any help would be much appreciated. Thanks!

edit retag flag offensive close merge delete

Comments

I checked in CMake opencv_world and this could be the difference between our compilations but theoretically this should not make any difference. Thank you very much! XvideosYoupornXhamster

Morichtykoko gravatar imageMorichtykoko ( 2018-12-30 08:38:15 -0600 )edit

4 answers

Sort by ยป oldest newest most voted
2

answered 2018-12-29 15:38:55 -0600

gromtron gravatar image

updated 2018-12-29 18:09:01 -0600

Replace the "const" statements at lines 96-127 in "color_detail.hpp" with "constexpr". It worked for me.

edit flag offensive delete link more

Comments

@gromtron could you mention which file to edit.

sturkmen gravatar imagesturkmen ( 2018-12-29 15:46:14 -0600 )edit

I've edited my answer

gromtron gravatar imagegromtron ( 2018-12-29 18:10:47 -0600 )edit

Thanks @gromtron.

MxBx gravatar imageMxBx ( 2019-01-01 14:26:01 -0600 )edit
0

answered 2018-12-22 10:02:38 -0600

zso gravatar image

Could you please explain how you compiled OpenCV with Cuda 10? I am trying to do the same with the same version of VS, CUDA and OpenCV and I get the error below. I checked in CMake opencv_world and this could be the difference between our compilations but theoretically this should not make any difference. Thank you very much!

14>------ Build started: Project: opencv_world, Configuration: Release x64 ------ 14>Building NVCC (Device) object modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Release/cuda_compile_generated_gpu_mat.cu.obj 14>nvcc fatal : Could not set up the environment for Microsoft Visual Studio using 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/../../../../../../../VC/Auxiliary/Build/vcvars64.bat' 14>CMake Error at cuda_compile_generated_gpu_mat.cu.obj.cmake:206 (message): 14> Error generating 14> D:/CUDA/opencv4/_VS/modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Release/cuda_compile_generated_gpu_mat.cu.obj 14> 14> 14>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code 1. 14>Done building project "opencv_world.vcxproj" -- FAILED.

edit flag offensive delete link more

Comments

The lines of code that you list correspond to the present HEAD of the master branch, where these lines have recently been updated w.r.t. the 4.0.0 tag. In the 4.0.0 tag, the initializer ChaturbateXnxxTubegalore

Morichtykoko gravatar imageMorichtykoko ( 2018-12-30 08:37:50 -0600 )edit
0

answered 2019-05-09 00:47:34 -0600

pabebe gravatar image

hi! Could you please explain how you compiled OpenCV with TBB under VS2017 ? beacause lastest TBB version suit for VC14 but VS2017 use VC15??? can I compile it without error? Thank you very much! image description

edit flag offensive delete link more
0

answered 2018-12-21 11:02:52 -0600

Strahinja gravatar image

updated 2018-12-21 11:04:42 -0600

The lines of code that you list correspond to the present HEAD of the master branch, where these lines have recently been updated w.r.t. the 4.0.0 tag. In the 4.0.0 tag, the initializer lists in these lines contain floating point literals. In the HEAD this is updated to use the names, declared as const float, that you now see in the initializer lists. I am not sure why this is considered dynamic initialization. It might depend on the c++ standard that is being used.

You have a couple of options to solve this:

  1. Play around with the c++ standard setting in the CMake options. More recent c++ standards should be able to process this.

  2. Check out the 4.0.0 tag. I recently built OpenCV from the 4.0.0 tag with a subset of CUDA modules. But in order to successfully build, I had to update the following two cmake files from a more recent commit in github:

    • cmake/OpenCVModule.cmake

    • modules/gapi/cmake/init.cmake

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2018-12-20 07:47:18 -0600

Seen: 2,709 times

Last updated: Dec 29 '18