最近我嘗試用CUDA支持構建OpenCV,並且在構建模塊cudaarithm時遇到了問題。用CUDA支持構建OpenCV錯誤轉換.cu
OpenCV的源:http://github.com/Itseez/opencv.git
OpenCV的分支: GIT中從克隆主分支
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版本: OS X約塞米蒂
步驟我用:
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*
那麼什麼:建設OpenCVSource /模塊時/ cudaarithm/src目錄/ CUDA/transpose.cu,像下面happend錯誤行動我拿:
檢查代碼,我發現這些不確定symboles在OpenCVSource/MOD定義ULES /核心/包括/ opencv2 /核心/ private.cuda.hpp
檢查代碼,我confrim的 「transpose.cu」 文件包括 「opencv2 /核心/ private.cuda.hpp」
檢查建築物日誌,並且我確認private.cuda.hpp是在頭文件的搜索路徑中
cp「opencv2/core/private.cuda.hpp」作爲另一個文件「opencv2/core/hawk .hpp「,然後編輯」transpose.cu「以包含這個新文件,並且我發現 」未解決的符號錯誤「消失。
雖然這是一個可行的解決方法,但我想知道原始OpenCV源代碼是否無法編譯。