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 to
avpriv_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 to
avpriv_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 to
avpriv_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 to
av_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 to
avpriv_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 function
parse_packet':
/home/mypath/ffmpeg/libavformat/utils.c:1285: undefined reference to av_parser_parse2'
/home/mypath/ffmpeg/libavformat/utils.c:1352: undefined reference to
av_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 to
av_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 to
av_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 to
avpriv_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 to
ff_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 ...