我正在尝试安装 opencv 3.1。我已经下载了 opencv (https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip)并解压。现在根据各种教程,我应该能够使用
$cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python -D BUILD_EXAMPLES=ON ..
$make -j $(nproc)
这很快就会失败并显示以下输出:
$ make -j $(nproc)
[ 0%] Automatic moc for target opencv_test_highgui
[ 0%] Automatic moc for target opencv_test_cvv
[ 0%] Automatic moc for target opencv_cvv
[ 0%] Automatic moc for target example_cvv_cvv_demo
[ 0%] Automatic moc for target opencv_highgui
[ 1%] Built target opencv_cudev
[ 1%] Built target numeric
[ 2%] Built target libjasper
[ 2%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o
[ 2%] Built target opencv_test_cvv_automoc
[ 2%] Built target opencv_test_highgui_automoc
[ 2%] Built target example_cvv_cvv_demo_automoc
[ 2%] Built target opencv_cvv_automoc
[ 2%] Built target opencv_highgui_automoc
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
In file included from /usr/include/cuda_runtime.h:78:0,
from <command-line>:0:
/usr/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
[ 3%] Built target multiview
[ 3%] Built target correspondence
CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:208 (message):
Error generating
/home/thijser/opencv-3.1.0/build/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:2122: 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
所以它说我使用了错误版本的 gcc,但是我已经通过替代方案使用了 4.9
$ sudo update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/gcc-6 60 auto mode
* 1 /usr/bin/gcc-4.9 20 manual mode
2 /usr/bin/gcc-5 25 manual mode
3 /usr/bin/gcc-6 60 manual mode
这里还有 cmake 输出
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python -D BUILD_EXAMPLES=ON ..
-- Detected version of GNU GCC: 49 (409)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- 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
-- 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/thijser/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx
-- CUDA detected: 8.0
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Found PythonInterp: /home/thijser/.virtualenvs/cv/bin/python (found suitable version "3.5.3", minimum required is "2.7")
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'numpy'
-- Found PythonInterp: /home/thijser/.virtualenvs/cv/bin/python3 (found suitable version "3.5.3", minimum required is "3.4")
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'numpy'
-- Found apache ant 1.9.8: /usr/bin/ant
-- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
-- The imported target "vtkRenderingPythonTkWidgets" references the file
"/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtk" references the file
"/usr/bin/vtk"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- Found VTK ver. 6.3.0 (usefile: /usr/lib/cmake/vtk-6.3/UseVTK.cmake)
-- Caffe: NO
-- Protobuf: YES
-- Glog: YES
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: YES
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
-- Tesseract: NO
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: YES
-- The protocol buffer compiler and libprotobuf were found
-- Tesseract: NO
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
--
-- General configuration for OpenCV 3.1.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 4.10.0-26-generic x86_64
-- CMake: 3.7.2
-- 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 6.3.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: NO
-- Extra dependencies: Qt5::Test Qt5::Concurrent Qt5::OpenGL /usr/lib/x86_64-linux-gnu/libwebp.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 dc1394 xine v4l1 v4l2 avcodec avformat avutil swscale /usr/lib/x86_64-linux-gnu/libbz2.so Qt5::Core Qt5::Gui Qt5::Widgets /usr/lib/x86_64-linux-gnu/libprotobuf.so /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/x86_64-linux-gnu/libsz.so /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib/x86_64-linux-gnu/libm.so correspondence multiview numeric glog gflags vtkRenderingOpenGL vtkImagingHybrid vtkIOImage vtkCommonDataModel vtkCommonMath vtkCommonCore vtksys vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkCommonExecutionModel vtkDICOMParser vtkIOCore /usr/lib/x86_64-linux-gnu/libz.so vtkmetaio /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libtiff.so vtkImagingCore vtkRenderingCore vtkCommonColor vtkFiltersExtraction vtkFiltersCore vtkFiltersGeneral vtkCommonComputationalGeometry vtkFiltersStatistics vtkImagingFourier vtkalglib vtkFiltersGeometry vtkFiltersSources vtkInteractionStyle vtkRenderingLOD vtkFiltersModeling vtkIOPLY vtkIOGeometry vtkFiltersTexture vtkRenderingFreeType /usr/lib/x86_64-linux-gnu/libfreetype.so vtkftgl vtkIOExport vtkRenderingAnnotation vtkImagingColor vtkRenderingContext2D vtkRenderingGL2PS vtkRenderingContextOpenGL /usr/lib/x86_64-linux-gnu/libgl2ps.so vtkRenderingLabel dl m pthread rt /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so tbb atomic cudart nppc nppi npps cufft -L/usr/lib/x86_64-linux-gnu
-- 3rdparty dependencies: libjasper
--
-- OpenCV modules:
-- To be built: cudev core cudaarithm flann hdf imgproc ml reg surface_matching video viz cudabgsegm cudafilters cudaimgproc cudawarping dnn fuzzy imgcodecs photo shape videoio cudacodec highgui objdetect plot ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo cvv datasets java rgbd stereo structured_light superres tracking videostab xfeatures2d ximgproc aruco optflow sfm stitching
-- Disabled: world contrib_world
-- Disabled by dependency: -
-- Unavailable: python2 python3 matlab
--
-- GUI:
-- QT 5.x: YES (ver 5.7.1)
-- QT OpenGL support: YES (Qt5::OpenGL 5.7.1)
-- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so)
-- VTK support: YES (ver 6.3.0)
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
-- WEBP: /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x0209)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.28)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.7)
-- JPEG 2000: build (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.5)
-- FFMPEG: YES
-- codec: YES (ver 57.64.101)
-- format: YES (ver 57.56.101)
-- util: YES (ver 55.34.101)
-- swscale: YES (ver 4.2.100)
-- 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.12.3) / libv4l2 (ver 1.12.3)
-- XIMEA: NO
-- Xine: YES (ver 1.2.6)
-- gPhoto2: NO
--
-- Parallel framework: TBB (ver 4.4 interface 9005)
--
-- Other third-party libraries:
-- Use IPP: 9.0.1 [9.0.1]
-- at: /home/thijser/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx
-- Use IPP Async: NO
-- Use VA: NO
-- Use Intel VA-API/OpenCL: NO
-- Use Eigen: YES (ver 3.3.2)
-- Use Cuda: YES (ver 8.0)
-- Use OpenCL: YES
-- Use custom HAL: NO
--
-- 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/thijser/opencv-3.1.0/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
--
-- Python 2:
-- Interpreter: /home/thijser/.virtualenvs/cv/bin/python (ver 3.5.3)
--
-- Python 3:
-- Interpreter: /home/thijser/.virtualenvs/cv/bin/python3 (ver 3.5.3)
--
-- Python (for build): /home/thijser/.virtualenvs/cv/bin/python
--
-- Java:
-- ant: /usr/bin/ant (ver 1.9.8)
-- JNI: /usr/lib/jvm/java-8-openjdk-amd64/include /usr/lib/jvm/java-8-openjdk-amd64/include/linux /usr/lib/jvm/java-8-openjdk-amd64/include
-- Java wrappers: YES
-- Java tests: YES
--
-- Matlab: Matlab not found or implicitly disabled
--
-- Documentation:
-- Doxygen: /usr/bin/doxygen (ver 1.8.13)
-- PlantUML: NO
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: YES
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/thijser/opencv-3.1.0/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/thijser/opencv-3.1.0/build
有人知道怎么修这个东西吗?
编辑输出
$ ls -l /usr/lib/nvidia-cuda-toolkit/bin
total 20900
-rwxr-xr-x 1 root root 9913472 sep 14 2016 cicc
drwxr-xr-x 2 root root 4096 mrt 27 14:19 crt
-rwxr-xr-x 1 root root 711 jan 20 20:25 g++
-rwxr-xr-x 1 root root 711 jan 20 19:48 gcc
lrwxrwxrwx 1 root root 40 jan 20 20:25 libcuinj64.so -> ../../x86_64-linux-gnu/libcuinj64.so.8.0
-rwxr-xr-x 1 root root 245680 sep 14 2016 nvcc
lrwxrwxrwx 1 root root 17 jan 20 20:25 nvcc.profile -> /etc/nvcc.profile
-rwxr-xr-x 1 root root 11226584 sep 14 2016 nvprof
其中 gcc 包含以下内容:
$ cat /usr/lib/nvidia-cuda-toolkit/bin/gcc
#!/bin/sh
# Check for g++ to avoid using different versions of gcc and g++ on systems
# with both g++-4.X and gcc-4.Y but not g++-4.Y installed.
prog=false
if g++-5 --version >/dev/null 2>&1; then
prog=gcc-5
elif g++-4.9 --version >/dev/null 2>&1; then
prog=gcc-4.9
elif g++-4.8 --version >/dev/null 2>&1; then
prog=gcc-4.8
elif clang-3.8 --version >/dev/null 2>&1; then
echo "ERROR: No supported gcc/g++ host compiler found, but clang-3.8 is available." >&2
echo " Use 'nvcc -ccbin clang-3.8' to use that instead." >&2
exit 1
else
echo "ERROR: No supported gcc/g++ host compiler found." >&2
echo " Use 'nvcc -ccbin <compiler>' to specify a host compiler." >&2
exit 1
fi
exec $prog "$@"
并且 g++ 包含
$ cat /usr/lib/nvidia-cuda-toolkit/bin/g++
#!/bin/sh
# Check for g++ to avoid using different versions of gcc and g++ on systems
# with both g++-4.X and gcc-4.Y but not g++-4.Y installed.
prog=false
if g++-5 --version >/dev/null 2>&1; then
prog=g++-5
elif g++-4.9 --version >/dev/null 2>&1; then
prog=g++-4.9
elif g++-4.8 --version >/dev/null 2>&1; then
prog=g++-4.8
elif clang-3.8 --version >/dev/null 2>&1; then
echo "ERROR: No supported gcc/g++ host compiler found, but clang-3.8 is available." >&2
echo " Use 'nvcc -ccbin clang-3.8' to use that instead." >&2
exit 1
else
echo "ERROR: No supported gcc/g++ host compiler found." >&2
echo " Use 'nvcc -ccbin <compiler>' to specify a host compiler." >&2
exit 1
fi
exec $prog "$@"
编辑编辑:添加 -D CUDA_NVCC_FLAGS="-ccbin gcc-4.9" 标志导致
compilation until 32% as which point it fails because
[ 32%] Linking CXX executable ../../bin/opencv_test_dnn
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::Message::GetTypeName() const'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::empty_string_'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::string const*, google::protobuf::internal::ArenaStringPtr)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)'
../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::Message::InitializationErrorString() const'
collect2: error: ld returned 1 exit status
modules/dnn/CMakeFiles/opencv_test_dnn.dir/build.make:259: recipe for target 'bin/opencv_test_dnn' failed
make[2]: *** [bin/opencv_test_dnn] Error 1
CMakeFiles/Makefile2:7156: recipe for target 'modules/dnn/CMakeFiles/opencv_test_dnn.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_test_dnn.dir/all] Error 2
[ 32%] Linking CXX executable ../../bin/opencv_perf_video
[ 32%] Built target opencv_perf_video
[ 32%] Linking CXX shared library ../../lib/libopencv_cudaarithm.so
[ 32%] Built target opencv_cudaarithm
[ 32%] Linking CXX shared library ../../lib/libopencv_cudawarping.so
[ 32%] Built target opencv_cudawarping
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
其他地方有人提出,如果使用 opencv 4.9 安装这个,则可能会出现此问题,但这会再次破坏 cuda。(并且 make clean 或 rm build -r 也无法解决问题)