opencv make在Ubuntu上支持CUDA失败

问题描述 投票:0回答:2

我正在尝试在ubuntu 15.10上使用CUDA支持构建OpenCV。 CMake显示有CUDA 7.5可用。 CMAKE很成功。当我运行make命令时,我得到以下输出:

   -- Configuring done
-- Generating done
-- Build files have been written to: /home/jishnu/Downloads/opencv-2.4.13/Release
[  5%] Built target IlmImf
[  6%] Built target opencv_core_pch_dephelp
[  6%] Built target pch_Generate_opencv_core
[  8%] Built target opencv_core
[  9%] Built target opencv_ts_pch_dephelp
[  9%] Built target pch_Generate_opencv_ts
[  9%] Built target opencv_imgproc_pch_dephelp
[  9%] Built target pch_Generate_opencv_imgproc
[ 12%] Built target opencv_imgproc
[ 12%] Built target opencv_flann_pch_dephelp
[ 12%] Built target pch_Generate_opencv_flann
[ 12%] Built target opencv_flann
[ 12%] Built target opencv_highgui_pch_dephelp
[ 13%] Built target pch_Generate_opencv_highgui
[ 15%] Built target opencv_highgui
[ 15%] Built target opencv_features2d_pch_dephelp
[ 15%] Built target pch_Generate_opencv_features2d
[ 16%] Built target opencv_features2d
[ 16%] Built target opencv_calib3d_pch_dephelp
[ 16%] Built target pch_Generate_opencv_calib3d
[ 18%] Built target opencv_calib3d
[ 19%] Built target opencv_video_pch_dephelp
[ 19%] Built target pch_Generate_opencv_video
[ 19%] Built target opencv_video
[ 19%] Built target opencv_ts
[ 19%] Built target opencv_perf_core_pch_dephelp
[ 19%] Built target pch_Generate_opencv_perf_core
[ 21%] Built target opencv_perf_core
[ 21%] Built target opencv_test_core_pch_dephelp
[ 21%] Built target pch_Generate_opencv_test_core
[ 22%] Built target opencv_test_core
[ 22%] Built target opencv_test_flann_pch_dephelp
[ 22%] Built target pch_Generate_opencv_test_flann
[ 23%] Built target opencv_test_flann
[ 24%] Built target opencv_perf_imgproc_pch_dephelp
[ 24%] Built target pch_Generate_opencv_perf_imgproc
[ 25%] Built target opencv_perf_imgproc
[ 25%] Built target opencv_test_imgproc_pch_dephelp
[ 25%] Built target pch_Generate_opencv_test_imgproc
[ 27%] Built target opencv_test_imgproc
[ 27%] Built target opencv_perf_highgui_pch_dephelp
[ 27%] Built target pch_Generate_opencv_perf_highgui
[ 28%] Built target opencv_perf_highgui
[ 28%] Built target opencv_test_highgui_pch_dephelp
[ 28%] Built target pch_Generate_opencv_test_highgui
[ 29%] Built target opencv_test_highgui
[ 29%] Built target opencv_perf_features2d_pch_dephelp
[ 29%] Built target pch_Generate_opencv_perf_features2d
[ 29%] Built target opencv_perf_features2d
[ 29%] Built target opencv_test_features2d_pch_dephelp
[ 30%] Built target pch_Generate_opencv_test_features2d
[ 31%] Built target opencv_test_features2d
[ 31%] Built target opencv_perf_calib3d_pch_dephelp
[ 31%] Built target pch_Generate_opencv_perf_calib3d
[ 31%] Built target opencv_perf_calib3d
[ 31%] Built target opencv_test_calib3d_pch_dephelp
[ 31%] Built target pch_Generate_opencv_test_calib3d
[ 33%] Built target opencv_test_calib3d
[ 33%] Built target opencv_ml_pch_dephelp
[ 33%] Built target pch_Generate_opencv_ml
[ 34%] Built target opencv_ml
[ 34%] Built target opencv_test_ml_pch_dephelp
[ 35%] Built target pch_Generate_opencv_test_ml
[ 36%] Built target opencv_test_ml
[ 36%] Built target opencv_perf_video_pch_dephelp
[ 37%] Built target pch_Generate_opencv_perf_video
[ 38%] Built target opencv_perf_video
[ 38%] Built target opencv_test_video_pch_dephelp
[ 39%] Built target pch_Generate_opencv_test_video
[ 40%] Built target opencv_test_video
[ 40%] Built target opencv_legacy_pch_dephelp
[ 40%] Built target pch_Generate_opencv_legacy
[ 47%] Built target opencv_legacy
[ 47%] Built target opencv_test_legacy_pch_dephelp
[ 47%] Built target pch_Generate_opencv_test_legacy
[ 47%] Built target opencv_test_legacy
[ 47%] Built target opencv_objdetect_pch_dephelp
[ 47%] Built target pch_Generate_opencv_objdetect
[ 48%] Built target opencv_objdetect
[ 48%] Built target opencv_perf_objdetect_pch_dephelp
[ 48%] Built target pch_Generate_opencv_perf_objdetect
[ 48%] Built target opencv_perf_objdetect
[ 48%] Built target opencv_test_objdetect_pch_dephelp
[ 48%] Built target pch_Generate_opencv_test_objdetect
[ 48%] Built target opencv_test_objdetect
[ 48%] Built target opencv_photo_pch_dephelp
[ 48%] Built target pch_Generate_opencv_photo
[ 48%] Built target opencv_photo
[ 48%] Built target opencv_perf_photo_pch_dephelp
[ 48%] Built target pch_Generate_opencv_perf_photo
[ 49%] Built target opencv_perf_photo
[ 49%] Built target opencv_test_photo_pch_dephelp
[ 49%] Built target pch_Generate_opencv_test_photo
[ 50%] Built target opencv_test_photo
[ 50%] Built target opencv_gpu_pch_dephelp
[ 50%] Built target pch_Generate_opencv_gpu
Linking CXX shared library ../../lib/libopencv_gpu.so
[ 61%] Built target opencv_gpu
[ 61%] Built target opencv_perf_gpu_pch_dephelp
[ 61%] Built target pch_Generate_opencv_perf_gpu
Linking CXX executable ../../bin/opencv_perf_gpu
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `ncvHaarGetClassifierSize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int&, unsigned int&, unsigned int&)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Ballard_Pos_findPosInHist_gpu(cv::gpu::PtrStepSz<int>, float4*, int3*, int, float, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::buildRTable_gpu(unsigned int const*, float const*, int, cv::gpu::PtrStepSz<short2>, int*, short2, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_calcPHist_gpu(int const*, int const*, cv::gpu::PtrStepSz<int>, float, float, float, float, int, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Ballard_PosRotation_calcHist_gpu(unsigned int const*, float const*, int, cv::gpu::PtrStepSz<short2>, int const*, cv::gpu::PtrStep<int>, int, int, float, float, int, float, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_buildImageFeatureList_gpu(unsigned int const*, float const*, int, int*, int, float, float, int, float2, float)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `int cv::gpu::device::hough::buildEdgePointList_gpu<float>(cv::gpu::PtrStepSz<unsigned char>, cv::gpu::PtrStepSz<unsigned char>, cv::gpu::PtrStepSz<unsigned char>, unsigned int*, float*)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `ncvDebugOutput(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_calcSHist_gpu(int const*, int const*, int*, float, float, float, float, float, int, int, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Ballard_PosScale_findPosInHist_gpu(cv::gpu::PtrStep<int>, int, int, int, float4*, int3*, int, float, float, float, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `int cv::gpu::device::hough::buildEdgePointList_gpu<int>(cv::gpu::PtrStepSz<unsigned char>, cv::gpu::PtrStepSz<unsigned char>, cv::gpu::PtrStepSz<unsigned char>, unsigned int*, float*)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Ballard_PosRotation_findPosInHist_gpu(cv::gpu::PtrStep<int>, int, int, int, float4*, int3*, int, float, float, float, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_setImageFeatures(cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `int cv::gpu::device::hough::buildEdgePointList_gpu<short>(cv::gpu::PtrStepSz<unsigned char>, cv::gpu::PtrStepSz<unsigned char>, cv::gpu::PtrStepSz<unsigned char>, unsigned int*, float*)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_findPosInHist_gpu(cv::gpu::PtrStepSz<int>, float4*, int3*, int, int, float, int, float, int, float, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `ncvSetDebugOutputHandler(void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Ballard_Pos_calcHist_gpu(unsigned int const*, float const*, int, cv::gpu::PtrStepSz<short2>, int const*, cv::gpu::PtrStepSz<int>, float, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_setTemplFeatures(cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>, cv::gpu::PtrStep<unsigned char>)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `loadFromXML(std::string const&, HaarClassifierCascadeDescriptor&, std::vector<HaarStage64, std::allocator<HaarStage64> >&, std::vector<HaarClassifierNode128, std::allocator<HaarClassifierNode128> >&, std::vector<HaarFeature64, std::allocator<HaarFeature64> >&)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_calcOHist_gpu(int const*, int const*, int*, float, float, float, int, int, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Guil_Full_buildTemplFeatureList_gpu(unsigned int const*, float const*, int, int*, int, float, float, int, float2, float)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `cv::gpu::device::hough::GHT_Ballard_PosScale_calcHist_gpu(unsigned int const*, float const*, int, cv::gpu::PtrStepSz<short2>, int const*, cv::gpu::PtrStep<int>, int, int, float, float, int, float, int)'
../../lib/libopencv_gpu.so.2.4.13: undefined reference to `ncvHaarLoadFromFile_host(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, HaarClassifierCascadeDescriptor&, NCVVector<HaarStage64>&, NCVVector<HaarClassifierNode128>&, NCVVector<HaarFeature64>&)'
collect2: error: ld returned 1 exit status
modules/gpu/CMakeFiles/opencv_perf_gpu.dir/build.make:364: recipe for target 'bin/opencv_perf_gpu' failed
make[2]: *** [bin/opencv_perf_gpu] Error 1
CMakeFiles/Makefile2:4453: recipe for target 'modules/gpu/CMakeFiles/opencv_perf_gpu.dir/all' failed
make[1]: *** [modules/gpu/CMakeFiles/opencv_perf_gpu.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2

我之前没有使用CUDA支持构建了OpenCV,它工作正常。

c++ opencv ubuntu
2个回答
0
投票

这可能是由于GPU设备与库的兼容性问题。您可以指定您正在使用的GPU设备以及它是物理设备还是模拟设备?


-1
投票

解决它检查你的cmake gcc和g ++版本需要相同的版本

© www.soinside.com 2019 - 2024. All rights reserved.