Install OpenCV-3.1.0 fails on Ubuntu 16.04 (‘memcpy’ was not declared in this scope)

Compiling on a clean install of Ubuntu 16.04 with cmake and using CUDA from the repo.

get the following error:

/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; ^/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; ^/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; ^/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; ^/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; ^/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; ^/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_sgd_solver.cu.o.cmake:266 (message): Error generating file /opt/caffe/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_sgd_solver.cu.o
Seems TensorFlow has similar issues: fayeshine/tensorflow@6c8c572


Answer:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")
add the line in the front of the CMakeLists.txt
the gcc is too new;


The installation scripts:

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j 4
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig

猜你喜欢

转载自blog.csdn.net/eagelangel/article/details/51530425