成功编译95%的OpenCV后,我收到错误
(...)
[ 95%] Built target opencv_videostab
[ 95%] Generating Matlab source files
[ 95%] Built target opencv_matlab_sources
[ 95%] Compiling Matlab source files. This could take a while...
CMake Error at compile.cmake:47 (message):
Failed to compile logPolar: /usr/bin/ld: cannot find -lopencv_core
/usr/bin/ld: cannot find -lopencv_imgproc
/usr/bin/ld: cannot find -lopencv_ml
/usr/bin/ld: cannot find -lopencv_highgui
/usr/bin/ld: cannot find -lopencv_objdetect
/usr/bin/ld: cannot find -lopencv_flann
/usr/bin/ld: cannot find -lopencv_features2d
/usr/bin/ld: cannot find -lopencv_photo
/usr/bin/ld: cannot find -lopencv_video
/usr/bin/ld: cannot find -lopencv_videostab
/usr/bin/ld: cannot find -lopencv_calib3d
/usr/bin/ld: cannot find -lopencv_stitching
/usr/bin/ld: cannot find -lopencv_superres
/usr/bin/ld: cannot find -lopencv_nonfree
collect2: ld returned 1 exit status
mex: link of ' "logPolar.mexa64"' failed.
make[2]: *** [modules/matlab/compile.proxy] Error 1
make[1]: *** [modules/matlab/CMakeFiles/opencv_matlab.dir/all] Error 2
make: *** [all] Error 2
这让我感到困惑,因为据我所知,所有这些都应该在构建过程的早期编译。使用的cmake命令是
cmake -D MATLAB_ROOT_DIR=/usr/lib/matlab2012a/ -D CMAKE_INSTALL_PREFIX=/home/user ..
答案 0 :(得分:2)
我有同样的问题,我想有一个原因,它还没有包含在官方发行版中。我的解决方案如下:
createAlignMTB.cpp createCalibrateDebevec.cpp createCalibrateRobertson.cpp createLineSegmentDetector.cpp createMergeDebevec.cpp createMergeMertens.cpp createMergeRobertson.cpp createTonemap.cpp createTonemapDrago.cpp createTonemapDurand.cpp createTonemapMantiuk.cpp createTonemapReinhard.cpp findCirclesGrid.cpp
我不需要其中任何一个,希望你也是如此,如果你这样做,你需要解决错误。 (源文件似乎一旦生成就不会重新生成,因此可以安全地修改)
答案 1 :(得分:1)
When encountering an error with building something with cmake, it's always a good idea to rerun it with VERBOSE=1 option.
我遇到类似的'/ usr / bin / ld问题:无法找到....'并且使VERBOSE = 1显示opencv库的链接器路径被错误地设置为L $ {ROOT_TO_OPENCV_BUILD} / lib / RelWithDebInfo,但它应该是L $ {ROOT_TO_OPENCV_BUILD} / lib。 所以问题出在CMake配置文件中。
超级肮脏的解决方法是简单地创建这样的虚假链接 cd $ {ROOT_TO_OPENCV_BUILD} / lib; ln -s。 RelWithDebInfo 这将使编译继续。稍后在createTonemapReinhard.cpp上给我 错误:未在此范围内声明'Ptr_TonemapReinhard' 很明显,matlab mex模块还没有准备好。