Opencv Linking CXX shared library ../../lib/libopencv_core.so

错误信息:
[ 31%] Linking CXX shared library …/…/lib/libopencv_core.so
CMake Error: cmake_symlink_library: System Error: Operation not supported
CMake Error: cmake_symlink_library: System Error: Operation not supported
modules/core/CMakeFiles/opencv_core.dir/build.make:2307: recipe for target ‘lib/libopencv_core.so.3.4.1’ failed
make[2]: *** [lib/libopencv_core.so.3.4.1] Error 1
make[2]: *** Deleting file ‘lib/libopencv_core.so.3.4.1’
CMakeFiles/Makefile2:1521: 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

版本问题(64位Ubuntu)

解决:

进入opencv目录下的3rdparty的对应目录CMakeFiles/ *.dir下(所有的,是3rdparty目录下所有的),打开flags.make,在C_FLAGS = 后添加-O3 -fPIC,用来支持在64位机上编译
Opencv Linking CXX shared library ../../lib/libopencv_core.so_第1张图片

如…/3rdparty/zlib/CMakeFiles/zlib.dir/flags.make

修改C_FLAGS = -W -Wall 为 C_FLAGS = -O3 -fPIC -W -Wall

修改CXX_FLAGS = -W -Wall 为 C_FLAGS = -O3 -fPIC -W -Wall

Opencv Linking CXX shared library ../../lib/libopencv_core.so_第2张图片修改后重新编译就没问题了!!!

注:如果出现System Error: Operation not supported

因使用vmware,在windows机器的共享目录中编译,可能也是会无法创建链接,就会提示上面的错误。

解决办法是,把源码复制到linux的本地目录中,比如/home等,在本地目录中编译就不会有这个问题。

文章参考:https://blog.csdn.net/chaorenlxl/article/details/24937599

你可能感兴趣的:(OpenCV,opencv,ubuntu)