我的Ubuntu 14.04计算机上安装了FFMpeg 2.7.2和所有必需的libav*
库。但是,当我尝试安装OpenCV 2.4.11(启用FFMpeg)时,出现以下错误:
/usr/bin/ld: cannot find -lavcodec
/usr/bin/ld: cannot find -lswresample
/usr/bin/ld: cannot find -lavutil
/usr/bin/ld: cannot find -lavformat
/usr/bin/ld: cannot find -lavcodec
/usr/bin/ld: cannot find -lswresample
/usr/bin/ld: cannot find -lavutil
/usr/bin/ld: cannot find -lavformat
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_annotation] Error 1
make[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2
make: *** [all] Error 2
我已经尝试将LD_LIBRARY_PATH
和PKG_CONFIG_PATH
指向包含FFmpeg库的位置。我也试过OpenCV 3.0并得到了同样的错误。
似乎这些版本的FFMpeg和OpenCV之间存在某种不兼容性。这有解决方法吗?
修改
例如locate libavcodec.a
输出:
/home/guel/cvpr2014/bin/dependencies/ffmpeg-2.4/libavcodec/libavcodec.a
/home/guel/cvpr2014/bin/dependencies/lib/libavcodec.a
/home/guel/cvpr2014/bin/dependencies/opencv-2.4.9/3rdparty/lib/libavcodec.a
/home/guel/ffmpeg_build/lib/libavcodec.a
/home/guel/git/ffmpeg/libavcodec/libavcodec.a
/home/guel/mplayer/ffmpeg/libavcodec/libavcodec.a
/home/guel/projects/mpegflow/dependencies/opencv-2.4.11/3rdparty/lib/libavcodec.a
所以,我有多个地方。那不好吗?