Ask Your Question
2

problems cross compiling OpenCV with FFMpeg for ARM Linux

asked 2013-03-26 10:05:26 -0600

gvi gravatar image

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 ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-10-26 02:54:12 -0600

taogashi gravatar image

seems questions asked here could hardly be answered for long... I followed the tutorial to finish the cross compilation on my 12.04, but have even no idea how to cross compile a basic example with openCV... /*********************/

include <cxcore.hpp>

include <cv.hpp>

include <highgui.hpp>

include <iostream>

using namespace cv; using namespace std;

int main(void) { Mat orig_image; Mat gray_image;

orig_image = imread("marker.jpg", IMREAD_COLOR);

if(!orig_image.data)
{
    cout << "failed to open orig_image!" << std::endl;
    return -1;
}

cvtColor(orig_image, gray_image, CV_BGRA2GRAY);

imwrite("GRAY_IMG.jpg", gray_image);
namedWindow( "Display window", WINDOW_AUTOSIZE );
imshow( "Display window", gray_image );

waitKey(0);
return 0;

} /********************/ i tried arm-linux-gnueabi-g++-4.6 -l/<my directory="">opencv-2.4.6.1/include/opencv/ -L/<my directory="">opencv-2.4.6.1/platforms/linux/build_arm/lib/ -lcv -lcxcore -lhighgui -lpthread -lrt -o basename $i .cpp $i; it just output : marker_detect.cpp:1:22: fatal error: cxcore.hpp: No such file or directory so depressed

edit flag offensive delete link more

Comments

Try:

arm-linux-gnueabi-g++ -o yourOutput main.cpp -I/your/opencv/include/dir -L/your/opencv/lib/dir -lopencv_core -lopencv_highgui

gtbustos gravatar imagegtbustos ( 2013-11-07 11:03:47 -0600 )edit

Question Tools

Stats

Asked: 2013-03-26 10:05:26 -0600

Seen: 3,494 times

Last updated: Nov 07 '13