Ask Your Question

OpenCV 2.4.11 Failed to Build

asked 2015-06-29 02:25:04 -0500

dida gravatar image

updated 2015-06-29 03:21:35 -0500

System: Ubuntu 15.04 x64

While make all -j 4, this is what I get after 51%

[ 51%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_mser.cpp.o
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o): In function `CvVideoWriter_FFMPEG::writeFrame(unsigned char const*, int, int, int, int, int)':
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG10writeFrameEPKhiiiii+0x18c): undefined reference to `avcodec_encode_video'
../../lib/libopencv_highgui.a(cap_ffmpeg.cpp.o): In function `CvVideoWriter_FFMPEG::close()':
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x146): undefined reference to `avcodec_encode_video'
collect2: error: ld returned 1 exit status
modules/highgui/CMakeFiles/opencv_test_highgui.dir/build.make:381: recipe for target 'bin/opencv_test_highgui' failed
make[2]: *** [bin/opencv_test_highgui] Error 1
CMakeFiles/Makefile2:1875: recipe for target 'modules/highgui/CMakeFiles/opencv_test_highgui.dir/all' failed
make[1]: *** [modules/highgui/CMakeFiles/opencv_test_highgui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 51%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_main.cpp.o
[ 51%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_fast.cpp.o
[ 52%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_nearestneighbors.cpp.o
[ 52%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_brisk.cpp.o
[ 52%] Building CXX object modules/calib3d/CMakeFiles/opencv_perf_calib3d.dir/perf/perf_cicrlesGrid.cpp.o
[ 52%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_descriptors_regression.cpp.o
[ 52%] Building CXX object modules/calib3d/CMakeFiles/opencv_perf_calib3d.dir/perf/perf_main.cpp.o
Linking CXX executable ../../bin/opencv_perf_calib3d
Linking CXX executable ../../bin/opencv_test_features2d
[ 52%] Built target opencv_perf_calib3d
[ 52%] Built target opencv_test_features2d
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2

Any pointer?

edit retag flag offensive close merge delete


Can you post your cmake parameters as well ?

dastaan90 gravatar imagedastaan90 ( 2015-06-29 03:41:05 -0500 )edit

Cool. Looks like you didn't have ffmpeg path set.

dastaan90 gravatar imagedastaan90 ( 2015-06-29 04:27:54 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-29 04:19:06 -0500

dida gravatar image


export LD_LIBRARY_PATH=/ffmpeg_install_path/lib/
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/ffmpeg_install_path/lib/pkgconfig
export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR:/ffmpeg_install_path/lib/

before make -j 4 seems did it.

I couldn't seems to post my own answer so this is it.

edit flag offensive delete link more


Now you can accept it ;)

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-29 06:20:48 -0500 )edit


You might notice that it is due to vtl4. I found two pages helpful regarding the same - (

and also I followed these steps - (

In short, I had to fix the patch by myself using github as help. And also I used WITH_FFMPEG=OFF with cmake step.

Hopefully it helps otherwise reach out to me :D


pallav bakshi gravatar imagepallav bakshi ( 2017-01-19 15:08:19 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-06-29 02:25:04 -0500

Seen: 2,741 times

Last updated: Jun 29 '15