最近我正在尝试构建具有 CUDA 支持的 OpenCV,但在构建模块 cudaarithm 时遇到了问题。
OpenCV 来源: git 克隆自:http://github.com/Itseez/opencv.git
OpenCV 分支:主分支
OpenCV 提交:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
1. cd in OpenCVSource, then mkdir myrelease, and cd myrelease
2. cmake -DPLANTUML_JAR=/usr/local/Cellar/plantuml/8002 -D BUILD_DOCS=1 -DPYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib -DPYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -Wno-dev -DNVCC_FLAGS_EXTRA="-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++" -DOPENCV_EXTRA_CXX_FLAGS=" -stdlib=libstdc++" -DOPENCV_EXTRA_EXE_LINKER_FLAGS="-stdlib=libstdc++" ..
3. make VERBOSE=1
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(61): *error: identifier "getInputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(67): *error: identifier "getOutputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(92): *error: identifier "syncOutput" is undefined*
最佳答案
所有,我想我找到了问题的原因。
在遇到此类问题之前,我已经使用 git repo 中的旧代码构建并安装了 OpenCV。这样我的/usr/local/include/opencv2 中已经有头文件了,尤其是有 /usr/local/include/opencv2/core/private.cuda.hpp .
但是,它是一个较旧的版本,没有定义上述问题中报告 undefined symbol 。同时我在构建nvcc的时候发现命令行中有-I/usr/local/include,所以使用错误私有(private).cuda.hpp .如您所知,它应该使用 OpenCVSource 中的那个,而不是旧安装的那个。
我认为解决方案是从我的计算机中优雅地删除原始安装的 OpenCV,然后重新构建。我正在尝试,稍后我会报告。
https://stackoverflow.com/questions/28472035/