Issue 1:
I am having this problem when installing OpenCV3 in a virtual environment--

[ 23%] 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/gamer/opencv/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o

modules/core/CMakeFiles/opencv_core.dir/build.make:398: 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:2248: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed

make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2

Makefile:149: recipe for target 'all' failed

make: *** [all] Error 2

My Cmake:

(.venv2) gamer@gamer:/opencv/build$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules -D BUILD_EXAMPLES=ON ..

General config:

-- General configuration for OpenCV 3.0.0 =====================================

-- Version control: 3.0.0

-- Platform:

-- Host: Linux 4.10.0-35-generic x86_64

-- CMake: 3.5.1

-- CMake generator: Unix Makefiles

-- CMake build tool: /usr/bin/make

-- Configuration: RELEASE

-- C/C++:

-- Built as dynamic libs?: YES

-- C++ Compiler: /usr/bin/c++ (ver 5.4.0)

-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG

-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG

-- C Compiler: /usr/bin/cc

-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG

-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG

-- Linker flags (Release):

-- Linker flags (Debug):

-- Precompiled headers: YES

-- Extra dependencies: /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so gtk-x11-2.0 gdk-x11-2.0 pangocairo-1.0 atk-1.0 cairo gdk_pixbuf-2.0 gio-2.0 pangoft2-1.0 pango-1.0 gobject-2.0 fontconfig freetype gthread-2.0 glib-2.0 dc1394 v4l1 v4l2 avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg dl m pthread rt cudart nppc nppi npps cufft

-- 3rdparty dependencies: libwebp ippicv

-- OpenCV modules:

-- To be built: hal cudev core cudaarithm flann imgproc ml reg surface_matching video cudabgsegm cudafilters cudaimgproc cudawarping face imgcodecs photo shape videoio cudacodec highgui objdetect optflow tracking ts ximgproc xobjdetect xphoto adas bgsegm bioinspired features2d latentsvm line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo datasets rgbd superres videostab xfeatures2d stitching python2 python3

-- Disabled: world contrib_world

-- Disabled by dependency: -

-- Unavailable: java viz cvv matlab

-- GUI:

-- QT: NO

-- GTK+ 2.x: YES (ver 2.24.30)

-- GThread : YES (ver 2.48.2)

-- GtkGlExt: NO

-- OpenGL support: NO

-- VTK support: NO

-- Media I/O:

-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)

-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )

-- WEBP: build (ver 0.3.1)

-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)

-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.6)

-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)

-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2.2.0)

-- GDAL: NO

-- Video I/O:

-- DC1394 1.x: NO

-- DC1394 2.x: YES (ver 2.2.4)

-- FFMPEG: YES

-- codec: YES (ver 56.60.100)

-- format: YES (ver 56.40.101)

-- util: YES (ver 54.31.100)

-- swscale: YES (ver 3.1.101)

-- resample: NO

-- gentoo-style: YES

-- GStreamer: NO

-- OpenNI: NO

-- OpenNI PrimeSensor Modules: NO

-- OpenNI2: NO

-- PvAPI: NO

-- GigEVisionSDK: NO

-- UniCap: NO

-- UniCap ucil: NO

-- V4L/V4L2: Using libv4l1 (ver 1.10.0) / libv4l2 (ver 1.10.0)

-- XIMEA: NO

-- Xine: NO

-- gPhoto2: NO

-- Other third-party libraries:

-- Use IPP: 8.2.1 [8.2.1]

-- at: /home/gamer/opencv/3rdparty/ippicv/unpack/ippicv_lnx

-- Use IPP Async: NO

-- Use Eigen: NO

-- Use TBB: NO

-- Use OpenMP: NO

-- Use GCD NO

-- Use Concurrency NO

-- Use C=: NO

-- Use pthreads for parallel for:

-- YES

-- Use Cuda: YES (ver 7.5)

-- Use OpenCL: YES

-- NVIDIA CUDA

-- Use CUFFT: YES

-- Use CUBLAS: NO

-- USE NVCUVID: NO

-- NVIDIA GPU arch: 20 21 30 35

-- NVIDIA PTX archs: 30

-- Use fast math: NO

-- OpenCL:

-- Version: dynamic

-- Include path: /home/gamer/opencv/3rdparty/include/opencl/1.2

-- Use AMDFFT: NO

-- Use AMDBLAS: NO

-- Python 2:

-- Interpreter: /home/gamer/neon/.venv2/bin/python2.7 (ver 2.7.12)

-- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)

-- numpy: /home/gamer/neon/.venv2/local/lib/python2.7/site-packages/numpy/core/include (ver 1.13.1)

-- packages path: lib/python2.7/site-packages

-- Python 3:

-- Interpreter: /usr/bin/python3 (ver 3.5.2)

-- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)

-- numpy: /home/gamer/.local/lib/python3.5/site-packages/numpy/core/include (ver 1.13.0)

-- packages path: lib/python3.5/site-packages

-- Python (for build): /home/gamer/neon/.venv2/bin/python2.7

-- Java:

-- ant: NO

-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include

-- Java wrappers: NO

-- Java tests: NO

-- Matlab:

-- mex: NO

-- Documentation:

-- Doxygen: NO

-- PlantUML: NO

-- Tests and samples:

-- Tests: YES

-- Performance tests: YES

-- C/C++ Examples: YES

-- Install path: /usr/local

-- cvconfig.h is in: /home/gamer/opencv/build

Issue 2:
Please state the information for your system

OpenCV version: 3.0/3.1/master

Host OS: Linux (Ubuntu 16.04)

Compiler: GCC 4.7/4.8/4.9/5.0

CUDA 7.5 (from synaptic package manager ("nvidia-cuda-toolkit"))

In which part of the OpenCV library you got the issue?

cuda

When trying to compile opencv (ubuntu 16.04) i get the following error:

[ 9%] 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:264 (message):

Error generating file

/home/mag/opencv/build_opencv_master/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o

The problem is known, but you need to make a workaround to support cuda. Here is a link to the same Proplem in the caffe git, but unfortunetly the solution doesnt work for me:

BVLC/caffe#4046