Ask Your Question
0

Error during installation of built opencv with CUDA

asked 2018-09-06 07:40:04 -0600

unlut gravatar image

updated 2018-09-10 11:51:17 -0600

I am trying to build opencv library from source. Here some platform information:

Ubuntu 16.04, gcc version 5.4.0, CUDA version 8

I added this flags for compilation:
-D ENABLE_CXX11=ON
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D OPENCV_EXTRA_MODULES_PATH=/home/USERNAME/opencvdir/opencv_contrib/modules
-D BUILD_opencv_hdf=OFF
-D WITH_CUDA=ON
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D WITH_CUBLAS=1
-D INSTALL_C_EXAMPLES=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_TESTS=OFF
First make operation is completed successfully, however, when I try to install (sudo make install), I got errors like this:
/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h(436): error: identifier "nullptr" is undefined /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h(436): error: expected a ";" /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h(200): error: expected a ";" /usr/include/c++/5/exception(63): error: expected a ";" /usr/include/c++/5/exception(68): error: expected a ";" ... /usr/include/c++/5/bits/exception_ptr.h(64): error: function "std::current_exception" returns incomplete type "std::__exception_ptr::exception_ptr" /usr/include/c++/5/bits/exception_ptr.h(64): error: expected a "{" /usr/include/c++/5/bits/exception_ptr.h(79): error: expected a ";"
...

Error limit reached. 100 errors detected in the compilation of "/tmp/tmpxft_0000024a_00000000-21_gpu_mat.compute_61.cpp1.ii". Compilation terminated. CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:266 (message): Error generating file /home/USERNAME/opencvdir/opencv/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o

It seems like c++11 issue however I can see -std=c++11 flag both among my c++ release and c++ debug flags. What could possibly cause this error? Thanks for taking your time to read.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-09-09 10:20:00 -0600

unlut gravatar image

I also had to enable c++11 for cuda compiler. Adding flags
-D CUDA_NVCC_FLAGS="-std=c++11 --expt-relaxed-constexpr"
solved the problem.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-09-06 07:38:06 -0600

Seen: 2,067 times

Last updated: Sep 10 '18