Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

problems cross compiling OpenCV with FFMpeg for ARM Linux

Hello all,

I am trying to cross compile OpenCV with FFMPEG for ARM Linux, but I get some errors.

First, I have cross compiled FFMPEG using these flags:

./configure --enable-cross-compile --cross-prefix=arm-linux-gnueabi- --cc=arm-linux-gnueabi-gcc --cxx=arm-linux-gnueabi-g++ --arch=arm --target-os=linux --disable-armv5te --disable-armv6 --disable-armv6t2 --enable-libopencv --enable-pic prefix=/home/mypath/ffmpeg_binARM

Then, I have modified "OpenCVFindLibsVideo.cmake" file In order to "see" the ffmpeg libraries:

--- FFMPEG ---

ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG) if(WITH_FFMPEG) if(WIN32) include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake") elseif(UNIX)

set(FFMPEG_INCLUDE_DIR /home/mypath/ffmpeg_binARM/include)
set(FFMPEG_LIB_DIR /home/mypath/ffmpeg_binARM/lib)

set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "${FFMPEG_LIB_DIR}/libavcodec.a"
      "${FFMPEG_LIB_DIR}/libavformat.a" "${FFMPEG_LIB_DIR}/libavutil.a"
      "${FFMPEG_LIB_DIR}/libswscale.a")
set(HAVE_GENTOO_FFMPEG TRUE)
if(EXISTS "${FFMPEG_LIB_DIR}/libavcodec.a")
    set(HAVE_FFMPEG_CODEC 1)
    set(ALIASOF_libavcodec_VERSION "Unknown")
    if(EXISTS "${FFMPEG_LIB_DIR}/libavformat.a")
      set(HAVE_FFMPEG_FORMAT 1)
      set(ALIASOF_libavformat_VERSION "Unknown")
      if(EXISTS "${FFMPEG_LIB_DIR}/libavutil.a")
        set(HAVE_FFMPEG_UTIL 1)
        set(ALIASOF_libavutil_VERSION "Unknown")
        if(EXISTS "${FFMPEG_LIB_DIR}/libswscale.a")
          set(HAVE_FFMPEG_SWSCALE 1)
          set(ALIASOF_libswscale_VERSION "Unknown")
          set(HAVE_FFMPEG 1)
        endif()
      endif()
    endif()
  endif()

ocv_include_directories(${FFMPEG_INCLUDE_DIR})

endif()

------------------------------------------------------------

Finally, I have tried to cross compile OpenCV using this help: http://docs.opencv.org/doc/tutorials/introduction/crosscompilation/arm_crosscompile_with_cmake.html

cd ~/opencv/platforms/linux mkdir -p Build_ARM cd Build_ARM

cmake -DSOFTFP=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../..

...and I get these errors when I do "make". Can anyone help me????


[ 34%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.o Linking CXX shared library ../../lib/libopencv_highgui.so /home/mypath/ffmpeg_binARM/lib/libavformat.a(matroskaenc.o): In function get_aac_sample_rates': /home/mypath/ffmpeg/libavformat/matroskaenc.c:460: undefined reference toavpriv_mpeg4audio_get_config' /home/mypath/ffmpeg_binARM/lib/libavformat.a(matroskaenc.o): In function put_xiph_codecpriv': /home/mypath/ffmpeg/libavformat/matroskaenc.c:440: undefined reference toavpriv_split_xiph_headers' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function has_decode_delay_been_guessed': /home/mypath/ffmpeg/libavformat/utils.c:916: undefined reference toavpriv_h264_has_num_reorder_frames' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function ff_read_frame_flush': /home/mypath/ffmpeg/libavformat/utils.c:1624: undefined reference toav_parser_close' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function has_decode_delay_been_guessed': /home/mypath/ffmpeg/libavformat/utils.c:916: undefined reference toavpriv_h264_has_num_reorder_frames' /home/mypath/ffmpeg/libavformat/utils.c:916: undefined reference to avpriv_h264_has_num_reorder_frames' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In functionparse_packet': /home/mypath/ffmpeg/libavformat/utils.c:1285: undefined reference to av_parser_parse2' /home/mypath/ffmpeg/libavformat/utils.c:1352: undefined reference toav_parser_close' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function read_frame_internal': /home/mypath/ffmpeg/libavformat/utils.c:1423: undefined reference toav_parser_init' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function avformat_find_stream_info': /home/mypath/ffmpeg/libavformat/utils.c:2715: undefined reference toav_parser_init' /home/mypath/ffmpeg/libavformat/utils.c:2999: undefined reference to avcodec_pix_fmt_to_codec_tag' /home/mypath/ffmpeg/libavformat/utils.c:3000: undefined reference toavpriv_find_pix_fmt' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function tb_unreliable': /home/mypath/ffmpeg/libavformat/utils.c:2674: undefined reference toff_raw_pix_fmt_tags' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function estimate_timings_from_pts': /home/mypath/ffmpeg/libavformat/utils.c:2311: undefined reference toav_parser_close' /home/mypath/ffmpeg_binARM/lib/libavformat.a(utils.o): In function ff_free_stream': /home/mypath/ffmpeg/libavformat/utils.c:3214: undefined reference toav_parser_close' /home/mypath/ffmpeg_binARM/lib/libavformat.a(allformats.o): In function av_register_all': /home/mypath/ffmpeg/libavformat/allformats.c:60: undefined reference toavcodec_register_all' /home/mypath/ffmpeg_binARM/lib/libavformat.a(dv.o): In function dv_read_header': /home/mypath/ffmpeg/libavformat/dv.c:511: undefined reference toavpriv_dv_frame_profile' /home/mypath/ffmpeg_binARM/lib/libavformat.a(dv.o): In function avpriv_dv_produce_packet': /home/mypath/ffmpeg/libavformat/dv.c:364: undefined reference toavpriv_dv_frame_profile' /home/mypath/ffmpeg_binARM/lib/libavformat.a(dv.o): In function dv_frame_offset': /home/mypath/ffmpeg/libavformat/dv.c:413: undefined reference toavpriv_dv_codec_profile' /home/mypath/ffmpeg_binARM/lib/libavformat.a(dvenc.o): In function dv_init_mux': /home/mypath/ffmpeg/libavformat/dvenc.c:317: undefined reference toavpriv_dv_codec_profile' /home/mypath/ffmpeg_binARM/lib/libavformat.a(flacdec.o): In function flac_read_header': /home/mypath/ffmpeg/libavformat/flacdec.c:178: undefined reference toavpriv_flac_parse_block_header' /home/mypath/ffmpeg/libavformat/flacdec.c:216: undefined reference to avpriv_flac_parse_streaminfo' /home/mypath/ffmpeg_binARM/lib/libavformat.a(flacenc.o): In functionflac_write_trailer': /home/mypath/ffmpeg/libavformat/flacenc.c:106: undefined reference to avpriv_flac_is_extradata_valid' /home/mypath/ffmpeg_binARM/lib/libavformat.a(flacenc_header.o): In functionff_flac_write_header': /home/mypath/ffmpeg/libavformat/flacenc_header.c:37: undefined reference to avpriv_flac_is_extradata_valid' /home/mypath/ffmpeg_binARM/lib/libavformat.a(frmdec.o): In functionfrm_read_header': /home/mypath/ffmpeg/libavformat/frmdec.c:64: undefined reference to avpriv_find_pix_fmt' /home/mypath/ffmpeg_binARM/lib/libavformat.a(isom.o): In functionff_mp4_read_dec_config_descr': /home/mypath/ffmpeg/libavformat/isom.c:460: undefined reference to avpriv_mpeg4audio_get_config' /home/mypath/ffmpeg/libavformat/isom.c:442: undefined reference toavpriv_mpa_freq_tab' /home/mypath/ffmpeg_binARM/lib/libavformat.a(latmenc.o): In function latm_decode_extradata': /home/mypath/ffmpeg/libavformat/latmenc.c:63: undefined reference toavpriv_mpeg4audio_get_config' /home/mypath/ffmpeg_binARM/lib/libavformat.a(latmenc.o): In function latm_write_packet': /home/mypath/ffmpeg/libavformat/latmenc.c:196: undefined reference toavpriv_copy_bits' /home/mypath/ffmpeg/libavformat/latmenc.c:198: undefined reference to avpriv_align_put_bits' /home/mypath/ffmpeg_binARM/lib/libavformat.a(latmenc.o): In functionlatm_write_frame_header': /home/mypath/ffmpeg/libavformat/latmenc.c:123: undefined reference to avpriv_copy_bits' /home/mypath/ffmpeg/libavformat/latmenc.c:129: undefined reference toavpriv_copy_pce_data' /home/mypath/ffmpeg_binARM/lib/libavformat.a(latmenc.o): In function latm_write_packet': /home/mypath/ffmpeg/libavformat/latmenc.c:194: undefined reference toavpriv_copy_bits' /home/mypath/ffmpeg_binARM/lib/libavformat.a(latmenc.o): In function latm_write_frame_header': /home/mypath/ffmpeg/libavformat/latmenc.c:119: undefined reference toavpriv_copy_bits' /home/mypath/ffmpeg_binARM/lib/libavformat.a(matroskadec.o): In function matroska_read_header': /home/mypath/ffmpeg/libavformat/matroskadec.c:1818: undefined reference toavpriv_mpeg4audio_sample_rates' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mov.o): In function mov_read_dac3': /home/mypath/ffmpeg/libavformat/mov.c:652: undefined reference toavpriv_ac3_channel_layout_tab' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mov.o): In function mov_read_dec3': /home/mypath/ffmpeg/libavformat/mov.c:679: undefined reference toavpriv_ac3_channel_layout_tab' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mp3dec.o): In function check': /home/mypath/ffmpeg/libavformat/mp3dec.c:268: undefined reference toavpriv_mpegaudio_decode_header' /home/mypath/ffmpeg/libavformat/mp3dec.c:268: undefined reference to avpriv_mpegaudio_decode_header' /home/mypath/ffmpeg/libavformat/mp3dec.c:268: undefined reference toavpriv_mpegaudio_decode_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mp3dec.o): In function mp3_parse_vbr_tags': /home/mypath/ffmpeg/libavformat/mp3dec.c:129: undefined reference toavpriv_mpegaudio_decode_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mp3dec.o): In function mp3_read_probe': /home/mypath/ffmpeg/libavformat/mp3dec.c:68: undefined reference toavpriv_mpa_decode_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mp3enc.o): In function mp3_write_audio_packet': /home/mypath/ffmpeg/libavformat/mp3enc.c:272: undefined reference toavpriv_mpegaudio_decode_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mp3enc.o): In function mp3_write_xing': /home/mypath/ffmpeg/libavformat/mp3enc.c:167: undefined reference toavpriv_mpegaudio_decode_header' /home/mypath/ffmpeg/libavformat/mp3enc.c:167: undefined reference to avpriv_mpegaudio_decode_header' /home/mypath/ffmpeg/libavformat/mp3enc.c:167: undefined reference toavpriv_mpegaudio_decode_header' /home/mypath/ffmpeg/libavformat/mp3enc.c:167: undefined reference to avpriv_mpegaudio_decode_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mp3enc.o):/home/mypath/ffmpeg/libavformat/mp3enc.c:167: more undefined references toavpriv_mpegaudio_decode_header' follow /home/mypath/ffmpeg_binARM/lib/libavformat.a(mp3enc.o): In function mp3_write_xing': /home/mypath/ffmpeg/libavformat/mp3enc.c:174: undefined reference toavpriv_mpa_freq_tab' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mpegtsenc.o): In function mpegts_write_packet_internal': /home/mypath/ffmpeg/libavformat/mpegtsenc.c:1100: undefined reference toavpriv_mpv_find_start_code' /home/mypath/ffmpeg_binARM/lib/libavformat.a(mxfenc.o): In function mxf_parse_dnxhd_frame': /home/mypath/ffmpeg/libavformat/mxfenc.c:1415: undefined reference toavpriv_dnxhd_get_frame_size' /home/mypath/ffmpeg_binARM/lib/libavformat.a(nutenc.o): In function find_expected_header': /home/mypath/ffmpeg/libavformat/nutenc.c:64: undefined reference toavpriv_mpa_freq_tab' /home/mypath/ffmpeg/libavformat/nutenc.c:64: undefined reference to avpriv_mpa_bitrate_tab' /home/mypath/ffmpeg_binARM/lib/libavformat.a(oggenc.o): In functionogg_write_header': /home/mypath/ffmpeg/libavformat/oggenc.c:484: undefined reference to avpriv_split_xiph_headers' /home/mypath/ffmpeg_binARM/lib/libavformat.a(oggenc.o): In functionogg_build_flac_headers': /home/mypath/ffmpeg/libavformat/oggenc.c:314: undefined reference to avpriv_flac_is_extradata_valid' /home/mypath/ffmpeg_binARM/lib/libavformat.a(oggparsedirac.o): In functiondirac_header': /home/mypath/ffmpeg/libavformat/oggparsedirac.c:40: undefined reference to avpriv_dirac_parse_sequence_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(oggparseflac.o): In functionflac_header': /home/mypath/ffmpeg/libavformat/oggparseflac.c:59: undefined reference to avpriv_flac_parse_streaminfo' /home/mypath/ffmpeg_binARM/lib/libavformat.a(oggparsevorbis.o): In functionvorbis_packet': /home/mypath/ffmpeg/libavformat/oggparsevorbis.c:360: undefined reference to avpriv_vorbis_parse_frame' /home/mypath/ffmpeg/libavformat/oggparsevorbis.c:326: undefined reference toavpriv_vorbis_parse_reset' /home/mypath/ffmpeg/libavformat/oggparsevorbis.c:329: undefined reference to avpriv_vorbis_parse_frame' /home/mypath/ffmpeg/libavformat/oggparsevorbis.c:338: undefined reference toavpriv_vorbis_parse_frame' /home/mypath/ffmpeg/libavformat/oggparsevorbis.c:355: undefined reference to avpriv_vorbis_parse_reset' /home/mypath/ffmpeg_binARM/lib/libavformat.a(oggparsevorbis.o): In functionvorbis_header': /home/mypath/ffmpeg/libavformat/oggparsevorbis.c:300: undefined reference to avpriv_vorbis_parse_extradata' /home/mypath/ffmpeg_binARM/lib/libavformat.a(rtpdec_jpeg.o): In functionjpeg_parse_packet': /home/mypath/ffmpeg/libavformat/rtpdec_jpeg.c:302: undefined reference to avpriv_mjpeg_bits_dc_luminance' /home/mypath/ffmpeg/libavformat/rtpdec_jpeg.c:302: undefined reference toavpriv_mjpeg_val_dc' /home/mypath/ffmpeg/libavformat/rtpdec_jpeg.c:302: undefined reference to avpriv_mjpeg_bits_dc_chrominance' /home/mypath/ffmpeg/libavformat/rtpdec_jpeg.c:302: undefined reference toavpriv_mjpeg_bits_ac_luminance' /home/mypath/ffmpeg/libavformat/rtpdec_jpeg.c:302: undefined reference to avpriv_mjpeg_val_ac_luminance' /home/mypath/ffmpeg/libavformat/rtpdec_jpeg.c:302: undefined reference toavpriv_mjpeg_bits_ac_chrominance' /home/mypath/ffmpeg/libavformat/rtpdec_jpeg.c:302: undefined reference to avpriv_mjpeg_val_ac_chrominance' /home/mypath/ffmpeg_binARM/lib/libavformat.a(rtpenc_mpv.o): In functionff_rtp_send_mpegvideo': /home/mypath/ffmpeg/libavformat/rtpenc_mpv.c:59: undefined reference to avpriv_mpv_find_start_code' /home/mypath/ffmpeg/libavformat/rtpenc_mpv.c:59: undefined reference toavpriv_mpv_find_start_code' /home/mypath/ffmpeg_binARM/lib/libavformat.a(sdp.o): In function xiph_extradata2config': /home/mypath/ffmpeg/libavformat/sdp.c:283: undefined reference toavpriv_split_xiph_headers' /home/mypath/ffmpeg_binARM/lib/libavformat.a(sdp.o): In function extradata2psets': /home/mypath/ffmpeg/libavformat/sdp.c:171: undefined reference toav_bitstream_filter_init' /home/mypath/ffmpeg/libavformat/sdp.c:187: undefined reference to av_bitstream_filter_filter' /home/mypath/ffmpeg/libavformat/sdp.c:188: undefined reference toav_bitstream_filter_close' /home/mypath/ffmpeg/libavformat/sdp.c:183: undefined reference to av_bitstream_filter_close' /home/mypath/ffmpeg/libavformat/sdp.c:174: undefined reference toavpriv_mpeg4audio_sample_rates' /home/mypath/ffmpeg_binARM/lib/libavformat.a(spdifdec.o): In function spdif_get_offset_and_codec': /home/mypath/ffmpeg/libavformat/spdifdec.c:60: undefined reference toavpriv_aac_parse_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(spdifenc.o): In function spdif_header_dts4': /home/mypath/ffmpeg/libavformat/spdifenc.c:174: undefined reference toavpriv_dca_sample_rates' /home/mypath/ffmpeg_binARM/lib/libavformat.a(spdifenc.o): In function spdif_header_aac': /home/mypath/ffmpeg/libavformat/spdifenc.c:354: undefined reference toavpriv_aac_parse_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(takdec.o): In function tak_read_header': /home/mypath/ffmpeg/libavformat/takdec.c:119: undefined reference toavpriv_tak_parse_streaminfo' /home/mypath/ffmpeg_binARM/lib/libavformat.a(ac3dec.o): In function ac3_eac3_probe': /home/mypath/ffmpeg/libavformat/ac3dec.c:58: undefined reference toavpriv_ac3_parse_header' /home/mypath/ffmpeg/libavformat/ac3dec.c:58: undefined reference to avpriv_ac3_parse_header' /home/mypath/ffmpeg_binARM/lib/libavformat.a(adtsenc.o): In functionadts_decode_extradata': /home/mypath/ffmpeg/libavformat/adtsenc.c:50: undefined reference to avpriv_mpeg4audio_get_config' /home/mypath/ffmpeg/libavformat/adtsenc.c:82: undefined reference toavpriv_copy_pce_data' /home/mypath/ffmpeg_binARM/lib/libavformat.a(adxdec.o): In function adx_read_header': /home/mypath/ffmpeg/libavformat/adxdec.c:90: undefined reference toavpriv_adx_decode_header' collect2: ld returned 1 exit status make[2]: * [lib/libopencv_highgui.so.2.4.9] Error 1 make[1]: [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 make: ** [all] Error 2