【发布时间】:2015-04-12 20:49:46
【问题描述】:
最近我正在尝试构建支持 CUDA 的 OpenCV,但在构建模块 cudaarithm 时遇到了问题。
OpenCV 来源: git 克隆自:http://github.com/Itseez/opencv.git
OpenCV 分支: master 分支
OpenCV 提交:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
CUDA 版本: CUDA 6.5
硬件: MacBook Pro(13 英寸,2010 年中)
GPU: NVIDIA GeForce 320M 256 MB
操作系统版本: OS X Yosemite
我使用的步骤:
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
预期结果:构建成功且没有错误
实际结果:在构建OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu时,出现如下错误:
/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*
那我采取什么行动:
检查代码,我发现这些未定义的符号定义在 OpenCVSource/modules/core/include/opencv2/core/private.cuda.hpp
检查代码,我确认“transpose.cu”文件包含“opencv2/core/private.cuda.hpp”
查看构建日志,确认private.cuda.hpp在头文件的搜索路径中
cp“opencv2/core/private.cuda.hpp”作为另一个文件“opencv2/core/hawk.hpp”,然后编辑“transpose.cu”以包含这个新文件,我发现 “未定义的符号错误”消失了。
虽然这是一个可行的解决方法,但我想知道原始 OpenCV 源是否无法编译。
【问题讨论】:
标签: opencv cuda compiler-errors