交叉编译opencv动态时,加入ffmpeg选项报错
求大神帮助,查过很多资料,试过很多方法,就是编译不过。编译时报如下错误:
[ 57%] Linking CXX shared library ../../lib/libopencv_highgui.so
../../3rdparty/lib/liblibjasper.a(jas_stream.c.o): In function `jas_stream_tmpfile':
jas_stream.c:(.text.jas_stream_tmpfile+0x5a): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, unsigned char*, unsigned int, AVFrame*)':
cap_ffmpeg.cpp:(.text._ZL25icv_av_write_frame_FFMPEGP15AVFormatContextP8AVStreamPhjP7AVFrame+0x2a): undefined reference to `avcodec_encode_video'
cap_ffmpeg.cpp:(.text._ZL25icv_av_write_frame_FFMPEGP15AVFormatContextP8AVStreamPhjP7AVFrame+0x54): undefined reference to `av_init_packet'
cap_ffmpeg.cpp:(.text._ZL25icv_av_write_frame_FFMPEGP15AVFormatContextP8AVStreamPhjP7AVFrame+0x7a): undefined reference to `av_rescale_q'
cap_ffmpeg.cpp:(.text._ZL25icv_av_write_frame_FFMPEGP15AVFormatContextP8AVStreamPhjP7AVFrame+0x9c): undefined reference to `av_write_frame'
cap_ffmpeg.cpp:(.text._ZL25icv_av_write_frame_FFMPEGP15AVFormatContextP8AVStreamPhjP7AVFrame+0xa6): undefined reference to `av_init_packet'
cap_ffmpeg.cpp:(.text._ZL25icv_av_write_frame_FFMPEGP15AVFormatContextP8AVStreamPhjP7AVFrame+0xc4): undefined reference to `av_write_frame'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvCapture_FFMPEG::init()':
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4initEv+0x64): undefined reference to `av_init_packet'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvCapture_FFMPEG::close()':
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG5closeEv+0xc): undefined reference to `sws_freeContext'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG5closeEv+0x1c): undefined reference to `av_free'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG5closeEv+0x26): undefined reference to `avcodec_close'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG5closeEv+0x36): undefined reference to `avformat_close_input'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG5closeEv+0x58): undefined reference to `av_free_packet'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvCapture_FFMPEG::open(char const*)':
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0x2c): undefined reference to `avformat_open_input'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0x3a): undefined reference to `avformat_find_stream_info'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0x9e): undefined reference to `avformat_network_init'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0xa2): undefined reference to `av_register_all'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0xaa): undefined reference to `av_log_set_level'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0xb8): undefined reference to `avcodec_find_decoder'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0xc6): undefined reference to `avcodec_open2'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0xda): undefined reference to `avcodec_alloc_frame'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0xe8): undefined reference to `avpicture_get_size'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4openEPKc+0x106): undefined reference to `avpicture_fill'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvCapture_FFMPEG::retrieveFrame(int, unsigned char**, int*, int*, int*, int*)':
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG13retrieveFrameEiPPhPiS2_S2_S2_+0x40): undefined reference to `avpicture_fill'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG13retrieveFrameEiPPhPiS2_S2_S2_+0x58): undefined reference to `sws_freeContext'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG13retrieveFrameEiPPhPiS2_S2_S2_+0x8e): undefined reference to `sws_getCachedContext'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG13retrieveFrameEiPPhPiS2_S2_S2_+0xb6): undefined reference to `sws_scale'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG13retrieveFrameEiPPhPiS2_S2_S2_+0x104): undefined reference to `sws_freeContext'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvCapture_FFMPEG::grabFrame()':
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0x4a): undefined reference to `av_free_packet'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0x5e): undefined reference to `av_read_frame'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0x76): undefined reference to `av_free_packet'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0xa4): undefined reference to `avcodec_decode_video2'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0xcc): undefined reference to `av_free_packet'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG9grabFrameEv+0x104): undefined reference to `av_free_packet'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvCapture_FFMPEG::seek(long long)':
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4seekEx+0x14e): undefined reference to `av_seek_frame'
cap_ffmpeg.cpp:(.text._ZN16CvCapture_FFMPEG4seekEx+0x162): undefined reference to `avcodec_flush_buffers'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvVideoWriter_FFMPEG::writeFrame(unsigned char const*, int, int, int, int, int)':
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG10writeFrameEPKhiiiii+0xce): undefined reference to `avpicture_fill'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG10writeFrameEPKhiiiii+0xf2): undefined reference to `sws_scale'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG10writeFrameEPKhiiiii+0x154): undefined reference to `avpicture_fill'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG10writeFrameEPKhiiiii+0x17c): undefined reference to `sws_getContext'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvVideoWriter_FFMPEG::close()':
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x1e): undefined reference to `sws_freeContext'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x4a): undefined reference to `av_free'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x52): undefined reference to `av_free'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x5a): undefined reference to `avcodec_close'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x60): undefined reference to `av_free'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x80): undefined reference to `av_freep'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x8a): undefined reference to `av_freep'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0x9e): undefined reference to `av_free'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0xf2): undefined reference to `av_write_trailer'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG5closeEv+0xfa): undefined reference to `avio_close'
CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o: In function `CvVideoWriter_FFMPEG::open(char const*, int, double, int, int, bool)':
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x94): undefined reference to `av_guess_format'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0xb6): undefined reference to `av_codec_get_id'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0xc0): undefined reference to `avformat_alloc_context'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x124): undefined reference to `avformat_network_init'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x128): undefined reference to `av_register_all'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x130): undefined reference to `av_log_set_level'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x184): undefined reference to `avformat_new_stream'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x1a6): undefined reference to `av_guess_codec'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x1b4): undefined reference to `avcodec_find_encoder'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x2d6): undefined reference to `av_sub_q'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x3e6): undefined reference to `avcodec_find_encoder'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x428): undefined reference to `avcodec_open2'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x44c): undefined reference to `avcodec_alloc_frame'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x45e): undefined reference to `avpicture_get_size'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x484): undefined reference to `avio_open'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x494): undefined reference to `avformat_write_header'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x4cc): undefined reference to `av_malloc'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x4e8): undefined reference to `avpicture_fill'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x4fa): undefined reference to `avcodec_alloc_frame'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x50c): undefined reference to `avpicture_get_size'
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiib+0x59a): undefined reference to `av_free'
collect2: error: ld returned 1 exit status
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:570: recipe for target 'lib/libopencv_highgui.so.2.4.2' failed