[ 54%] Linking CXX shared library libCaffe2_CPU.so
/usr/bin/ld: cannot find -lopencv_dep_cudart
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/Caffe2_CPU.dir/build.make:4245: recipe for target ‘caffe2/libCaffe2_CPU.so’ failed
make[2]: * [caffe2/libCaffe2_CPU.so] Error 1
CMakeFiles/Makefile2:2684: recipe for target ‘caffe2/CMakeFiles/Caffe2_CPU.dir/all’ failed
make[1]: * [caffe2/CMakeFiles/Caffe2_CPU.dir/all] Error 2
Makefile:138: recipe for target ‘all’ failed
/usr/bin/ld: cannot find -lopencv_dep_cudart
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/Caffe2_CPU.dir/build.make:4245: recipe for target ‘caffe2/libCaffe2_CPU.so’ failed
make[2]: * [caffe2/libCaffe2_CPU.so] Error 1
CMakeFiles/Makefile2:2684: recipe for target ‘caffe2/CMakeFiles/Caffe2_CPU.dir/all’ failed
make[1]: * [caffe2/CMakeFiles/Caffe2_CPU.dir/all] Error 2
Makefile:138: recipe for target ‘all’ failed
make: * [all] Error 2
在makefile 中将cmake ..更改为
cmake -D CUDA_USE_STATIC_CUDA_RUNTIME=OFF ..
或者在CMakeLists中添加
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
重新make即可
当然也可以按照下面的做法:将方式1改写为方式2,就可以了,而非全部链接
方式一: