Skip to content

OpenCV 3.0 build fails on Ubuntu 12.04 #5131

@ulrichstern

Description

@ulrichstern

I used the official 3.0 release (http://opencv.org/downloads.html) and ran into this during a build on Ubuntu 12.04:

...
[ 16%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o
In file included from /home/uli/opencv/opencv-3.0.0/modules/videoio/src/cap_ffmpeg.cpp:45:0:
/home/uli/opencv/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1546:71: error: use of enum ‘AVCodecID’ without previous declaration
/home/uli/opencv/opencv-3.0.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1556:83: error: use of enum ‘AVCodecID’ without previous declaration
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o] Error 1

I took a quick look at the code, and the reason for the build error seems a bug in cap_ffmpeg_impl.hpp. Early in the file, CV_CODEC_ID gets defined to be AVCodecID or CodecID depending on FFmpeg version:

#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0)
#  define CV_CODEC_ID AVCodecID 
#  define CV_CODEC(name) AV_##name
#else
#  define CV_CODEC_ID CodecID
#  define CV_CODEC(name) name
#endif

But on lines 1546 and 1556 (errors above), AVCodecID is used instead of CV_CODEC_ID. Fixing this made my build work. I posted this solution on stackoverflow, where someone else ran into the issue. The same issue is also reported at least twice on http://answers.opencv.org.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions