OpenCV 2.4.6 添加了对 CUDA 5.5 的支持,但尝试构建它失败了。CUDA 是从 Fedora 18 的存储库安装的。没有 CUDA 支持的 OpenCV 本身也运行良好。
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/gpumat.cpp.o
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:288:52: error: 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)' should have been declared inside 'cv::gpu'
bool cv::gpu::deviceSupports(FeatureSet feature_set)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:288:6: warning: no previous declaration for 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)' [-Wmissing-declarations]
bool cv::gpu::deviceSupports(FeatureSet feature_set)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: At global scope:
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:359:49: error: no 'size_t cv::gpu::DeviceInfo::sharedMemPerBlock() const' member function declared in class 'cv::gpu::DeviceInfo'
size_t cv::gpu::DeviceInfo::sharedMemPerBlock() const
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:794:6: error: redefinition of 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)'
void cv::gpu::createContinuous(int rows, int cols, int type, GpuMat& m)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:551:17: error: 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline void createContinuous(int rows, int cols, int type, GpuMat& m)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:806:6: error: redefinition of 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)'
void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:559:17: error: 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline void ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:831:8: error: redefinition of 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)'
GpuMat cv::gpu::allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:567:19: error: 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline GpuMat allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
^
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-unnamed-type-template-args" [enabled by default]
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/gpumat.cpp.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
有没有办法解决这个问题?还是新版本的 GCC 有问题?