Ask Your Question
0

Ubuntu build fails with memcpy not declared in string.h

asked 2016-11-26 06:22:54 -0500

JohnBabrick gravatar image

updated 2016-11-26 07:40:25 -0500

Ubuntu Linux 16.04 LTS with GEForce GTX-950 GPU X86_64

Trying to build OpenCV on Ubuntu 16.04, make fails with an error compiling cuda file:

**[ 16%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o
/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
   return (char *) memcpy (__dest, __src, __n) + __n;
                                          ^
CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:266 (message):
  Error generating file
  /home/johann/Downloads/opencv-3.1.0/release/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o
modules/core/CMakeFiles/opencv_core.dir/build.make:63: recipe for target** 'modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o' failed
make[2]: *** [modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o] Error 1
CMakeFiles/Makefile2:1722: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2


Below is the output from the CMAKE configuration step:

johann@mars:~/Downloads/opencv-3.1.0/release$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
-- Detected version of GNU GCC: 54 (504)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Could NOT find TIFF (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR) 
-- Could NOT find JPEG (missing:  JPEG_LIBRARY JPEG_INCLUDE_DIR) 
-- Could NOT find Jasper (missing:  JASPER_LIBRARIES JASPER_INCLUDE_DIR) 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libdc1394-2'
--   No package 'libdc1394-2' found
-- Checking for module 'libdc1394'
--   No package 'libdc1394' found
-- Checking for module 'libv4l1'
--   No package 'libv4l1' found
-- Checking for module 'libv4l2'
--   No package 'libv4l2' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/johann/Downloads/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx
-- CUDA detected: 7.5
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode ...
(more)
edit retag flag offensive close merge delete

Comments

Thanks for reformatting.

JohnBabrick gravatar imageJohnBabrick ( 2016-11-26 07:03:51 -0500 )edit

I tried a fresh build using the following script :

https://github.com/milq/scripts-ubunt...

and got the same error.

JohnBabrick gravatar imageJohnBabrick ( 2016-11-26 10:20:07 -0500 )edit
JohnBabrick gravatar imageJohnBabrick ( 2016-11-26 10:22:12 -0500 )edit
1

i know, you might be tired doing this, but can you try to disable anything cuda related for a try ? (also, clean up your build folder)

(this would at least narrow down the problem)

berak gravatar imageberak ( 2016-11-26 10:30:40 -0500 )edit
1

Disable Cuda? hehehe... you know what I had to go thorugh last weekend to get the Nvidia card working at all? I ain't touching that... :)

JohnBabrick gravatar imageJohnBabrick ( 2016-11-26 10:55:37 -0500 )edit

hehe, i see. i can give out free hugs, but unfortunately i can't help here

would above comment be an answer ? is it solved now ?

(i'd just propell it to one, then (no need to wait for another 24 hrs)

berak gravatar imageberak ( 2016-11-26 11:13:04 -0500 )edit

Yes, the build just completed. I think the github page seemed to indicate that a bug was logged on this but apparently it has not been fixed. If you wish please move the answer over the the answer box.

JohnBabrick gravatar imageJohnBabrick ( 2016-11-26 11:43:19 -0500 )edit

sure ! will do !

berak gravatar imageberak ( 2016-11-26 11:50:56 -0500 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2016-11-26 10:53:23 -0500

JohnBabrick gravatar image

I seem to have found the answer in the comments at https://github.com/opencv/opencv/issu...:

Simple replace in opencv/cmake/OpencvDetectCuda.cmake

set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1}) to

set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -D_FORCE_INLINES -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1}) it's work for me!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-11-26 06:22:54 -0500

Seen: 1,035 times

Last updated: Nov 26 '16