My nvcc version output:
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2017 NVIDIA Corporation Built on Fri_Sep__1_21:08:03_CDT_2017 Cuda compilation tools, release 9.0, V9.0.176
my gcc version and operation system:
Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Thread model: posix gcc version 6.4.0 20180424 (Ubuntu 6.4.0-17ubuntu1~16.04)
I am trying to install opencv-4.0.0.Beta with cuda, the Cmake command is:
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D OPENCV_EXTRA_MODULES_PATH=/opcv/opencv_contrib/modules \ -D WITH_CUDA=ON \ -D ENABLE_FAST_MATH=ON \ -D CUDA_FAST_MATH=ON \ -D WITH_CUBLAS=ON \ -D BUILD_CUDA_STUBS=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D BUILD_EXAMPLES=ON \ -D PYTHON3_INCLUDE_DIR=/root/anaconda3/include/python3.6m \ -D PYTHON3_LIBRARY=/root/anaconda3/lib \ -D PYTHON_DEFAULT_EXECUTABLE=/root/anaconda3/bin/python3 \ -D PYTHON3_PACKAGES_PATH=/root/anaconda3/lib/python3.6/site-packages \ -D BUILD_opencv_python2=OFF \ -D PYTHON3_EXCUTABLE=/root/anaconda3/bin/python3 ..
However, during 'make', an failure reported: [ 17%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o cd /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /root/anaconda3/lib/python3.6/site-packages/cmake/data/bin/cmake -E make_directory /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/. cd /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /root/anaconda3/lib/python3.6/site-packages/cmake/data/bin/cmake -D verbose:BOOL=1 -D build_configuration:STRING=RELEASE -D generated_file:STRING=/opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -D generated_cubin_file:STRING=/opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o.cubin.txt -P /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.RELEASE.cmake -- Removing /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o /root/anaconda3/lib/python3.6/site-packages/cmake/data/bin/cmake -E remove /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -- Generating dependency file: /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend /usr/local/cuda-9.0/bin/nvcc -M -D__CUDACC__ /opcv/opencv/modules/core/src/cuda/gpu_mat.cu -o /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend -m64 -D__OPENCV_BUILD=1 -D_USE_MATH_DEFINES -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DOPENCV_WITH_ITT=1 -Xcompiler ,\"-fsigned-char\",\"-W\",\"-Wall\",\"-Werror=return-type\",\"-Werror=non-virtual-dtor\",\"-Werror=address\",\"-Werror=sequence-point\",\"-Wformat\",\"-Werror=format-security\",\"-Wmissing-declarations\",\"-Winit-self\",\"-Wpointer-arith\",\"-Wuninitialized\",\"-Winit-self\",\"-Wno-narrowing\",\"-Wno-comment\",\"-fdiagnostics-show-option\",\"-Wno-long-long\",\"-pthread\",\"-fomit-frame-pointer\",\"-ffunction-sections\",\"-fdata-sections\",\"-msse\",\"-msse2\",\"-msse3\",\"-fvisibility=hidden\",\"-Wno-undef\",\"-Wno-enum-compare\",\"-Wno-unused-function\",\"-Wno-shadow\",\"-Wno-unused-but-set-variable\",\"-O3\",\"-DNDEBUG\",\"-DNDEBUG\" -ccbin gcc-6 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -D_FORCE_INLINES -Xcompiler -DCVAPI_EXPORTS -Xcompiler -fPIC --std=c++11 -DNVCC -I/usr/local/cuda-9.0/include -I/opcv/opencv/build/3rdparty/ippicv/ippicv_lnx/include -I/opcv/opencv/build/3rdparty/ippicv/ippiw_lnx/include -I/opcv/opencv/build -I/opcv/opencv/modules/core/src -I/opcv/opencv/modules/core/include -I/opcv/opencv/build/modules/core -I/opcv/opencv_contrib/modules/cudev/include -I/opcv/opencv/3rdparty/zlib -I/opcv/opencv/build/3rdparty/zlib -I/opcv/opencv/3rdparty/include/opencl/1.2 -I/opcv/opencv/3rdparty/ittnotify/include -- Generating temporary cmake readable file: /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp /root/anaconda3/lib/python3.6/site-packages/cmake/data/bin/cmake -D input_file:FILEPATH=/opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend -D output_file:FILEPATH=/opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp -D verbose=1 -P /root/anaconda3/lib/python3.6/site-packages/cmake/data/share/cmake-3.12/Modules/FindCUDA/make2cmake.cmake -- Copy if different /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp to /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend /root/anaconda3/lib/python3.6/site-packages/cmake/data/bin/cmake -E copy_if_different /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend -- Removing /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp and /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend /root/anaconda3/lib/python3.6/site-packages/cmake/data/bin/cmake -E remove /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend -- Generating /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o /usr/local/cuda-9.0/bin/nvcc /opcv/opencv/modules/core/src/cuda/gpu_mat.cu -c -o /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -m64 -D__OPENCV_BUILD=1 -D_USE_MATH_DEFINES -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DOPENCV_WITH_ITT=1 -Xcompiler ,\"-fsigned-char\",\"-W\",\"-Wall\",\"-Werror=return-type\",\"-Werror=non-virtual-dtor\",\"-Werror=address\",\"-Werror=sequence-point\",\"-Wformat\",\"-Werror=format-security\",\"-Wmissing-declarations\",\"-Winit-self\",\"-Wpointer-arith\",\"-Wuninitialized\",\"-Winit-self\",\"-Wno-narrowing\",\"-Wno-comment\",\"-fdiagnostics-show-option\",\"-Wno-long-long\",\"-pthread\",\"-fomit-frame-pointer\",\"-ffunction-sections\",\"-fdata-sections\",\"-msse\",\"-msse2\",\"-msse3\",\"-fvisibility=hidden\",\"-Wno-undef\",\"-Wno-enum-compare\",\"-Wno-unused-function\",\"-Wno-shadow\",\"-Wno-unused-but-set-variable\",\"-O3\",\"-DNDEBUG\",\"-DNDEBUG\" -ccbin gcc-6 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -D_FORCE_INLINES -Xcompiler -DCVAPI_EXPORTS -Xcompiler -fPIC --std=c++11 -DNVCC -I/usr/local/cuda-9.0/include -I/opcv/opencv/build/3rdparty/ippicv/ippicv_lnx/include -I/opcv/opencv/build/3rdparty/ippicv/ippiw_lnx/include -I/opcv/opencv/build -I/opcv/opencv/modules/core/src -I/opcv/opencv/modules/core/include -I/opcv/opencv/build/modules/core -I/opcv/opencv_contrib/modules/cudev/include -I/opcv/opencv/3rdparty/zlib -I/opcv/opencv/build/3rdparty/zlib -I/opcv/opencv/3rdparty/include/opencl/1.2 -I/opcv/opencv/3rdparty/ittnotify/include Segmentation fault (core dumped) -- Removing /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o /root/anaconda3/lib/python3.6/site-packages/cmake/data/bin/cmake -E remove /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.RELEASE.cmake:281 (message): Error generating file /opcv/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
modules/core/CMakeFiles/opencv_core.dir/build.make:63: recipe for target 'modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o' failed make[2]: * [modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o] Error 1 make[2]: Leaving directory '/opcv/opencv/build' CMakeFiles/Makefile2:3023: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed make[1]: [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make[1]: Leaving directory '/opcv/opencv/build' Makefile:162: recipe for target 'all' failed make: ** [all] Error 2
How can I fix this?