-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
When installing OpenCV 3.4.1 (I could reproduce the same behavior also with version 3.3.0) with +cuda and +dnn, then the compilation failed, because one of the header files from the OpenCV dnn module has the same name as a cuda header file and the cuda header file is included instead of the OpenCV one.
I think that the error is arising, from a conflict between
/scratch/spackapps/spack-stage/spack-stage-BRyfMH/opencv-3.4.1/modules/dnn/src/ocl4dnn/include/math_functions.hpp
and
/cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/cuda-9.0.176-uqbi62cpkd645vbehqscqy42zhdvfvqq/include/math_functions.hpp
for some reason, the CUDA header file is found first, when actually the header file from the dnn module would need to be included.
The cuda header file then includes another CUDA header file func_macro.h which causes the error message
#error -- incorrect inclusion of a cudart header file
According to
func_macro.h should never be included.
Expected Result
OpenCV 3.4.1 with CUDA 9.0 should build fine.
Actual Result
[ 36%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/permute_layer.cpp.o
cd /scratch/spackapps/spack-stage/spack-stage-BRyfMH/opencv-3.4.1/spack-build/modules/dnn && /cluster/apps/spack/lib/spack/env/gcc/g++ -DCVAPI_EXPORTS -DHAVE_PROTOBUF=1 -DOPENCV_TRAITS_ENABLE_DEPRECATED -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -isystem /scratch/spackapps/spack-stage/spack-stage-BRyfMH/opencv-3.4.1/spack-build -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/dnn/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/dnn/src -I/scratch/spackapps/spack-stage/spack-stage-BRyfMH/opencv-3.4.1/spack-build/modules/dnn -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/cudev/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/core/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/imgproc/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/dnn/src/ocl4dnn/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/ts/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/imgcodecs/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/videoio/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/highgui/include -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/dnn/test -I/cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/dnn/perf -isystem /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/protobuf-3.1.0-l4okq4ruz7pclkxnr7kcsoghssoprscg/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -Wno-shadow -Wno-parentheses -Wno-maybe-uninitialized -Wno-sign-promo -Wno-missing-declarations -Wno-deprecated -Wno-missing-declarations -Wno-shadow -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-sign-compare -Wno-sign-promo -Wno-undef -Wno-ignored-qualifiers -Wno-extra -Wno-unused-function -Wno-deprecated-declarations -Wno-error=non-virtual-dtor -Wno-unused-parameter -Wno-undef -Wno-ignored-qualifiers -Wno-enum-compare -Wno-deprecated-declarations -Wno-invalid-offsetof -O2 -g -DNDEBUG -fPIC -o CMakeFiles/opencv_dnn.dir/src/layers/permute_layer.cpp.o -c /cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/dnn/src/layers/permute_layer.cpp
In file included from /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/cuda-8.0.61-mxdqob5lveng3f2utljrysrx4vjp7g3m/include/math_functions.hpp:1674:0,
from /cluster/apps/spack/var/spack/stage/opencv-3.4.1-zxmgmfmwzkooupmg24dzntqp2h2dqy3k/opencv-3.4.1/modules/dnn/src/layers/mvn_layer.cpp:46:
/cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/cuda-8.0.61-mxdqob5lveng3f2utljrysrx4vjp7g3m/include/crt/func_macro.h:50:2: error: #error -- incorrect inclusion of a cudart header file
#error -- incorrect inclusion of a cudart header file
^
Steps to reproduce the issue
spack install --no-checksum [email protected]+core+cuda+dnn+gtk+png+highgui+imgproc+shared+tiff+zlib~python~eigen ^[email protected]+ncurses+openssl ^[email protected]+shared ^[email protected] ^[email protected]+X ^[email protected] ^[email protected] ^[email protected]+tk ^[email protected] ^[email protected]+libmount ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected]+bzip2+curses+git+libunistring+libxml2+tar+xz ^[email protected] ^[email protected] ^[email protected] %[email protected] arch=linux-centos7-x86-64
Information on your system
Plattform: CentOS Linux release 7.4.1708 (Core)
Kernel: 3.10.0-693.11.6.el7.x86_64