Error building OpenCV 2.4.x "Undefined reference to av_opt_set@LIBAVUTIL_51"
I have tried building all versions of 2.4, and they all fail when "Linking CXX executable ../../bin/opencv_test_core" with:
/home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_opt_set@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_strcasecmp@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_bprint_finalize@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_timecode_make_smpte_tc_string@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_timecode_make_string@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_realloc_f@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_timecode_get_smpte_from_framenum@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_timecode_init@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_samples_set_silence@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_calloc@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_opt_get@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_strncasecmp@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_samples_fill_arrays@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_get_media_type_string@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_dynarray_add@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_bprint_init@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_asprintf@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_sample_fmt_is_planar@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_samples_get_buffer_size@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_opt_get_int@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_timecode_make_mpeg_tc_string@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_rescale_q_rnd@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_bprintf@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_samples_copy@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_get_default_channel_layout@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_timecode_init_from_string@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_bprint_chars@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_des_mac@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavcodec.so.54: undefined reference to 'av_timecode_adjust_ntsc_framenum@LIBAVUTIL_51' /home/root/opencv/2.4.3/build/lib/libavformat.so.54: undefined reference to 'av_timegm@LIBAVUTIL_51 ...