DM365交叉编译问题总结
2014-05-22 20:05
1281 查看
PC系统用的是:Ubuntu 12.04.4 LTS
交叉工具安装包:mvl_5_0_0801921_demo_sys_setuplinux.bin
编译开源流媒体服务工程:crtmpserver,其中用到ffmpeg,zlib等开源库。采用静态编译方式,将ffmpeg编译成libavformat.a,libavcodec.a,libavutil.a等静态库,将zlib编译成libz.a,然后再crtmpserver中引用。编译采用cmake的方式,crtmpserver的工程文件CMakeLists.txt中的库依赖关系如下:
修改库依赖关系如下:
重新调整库的依赖关系如下:
交叉工具安装包:mvl_5_0_0801921_demo_sys_setuplinux.bin
编译开源流媒体服务工程:crtmpserver,其中用到ffmpeg,zlib等开源库。采用静态编译方式,将ffmpeg编译成libavformat.a,libavcodec.a,libavutil.a等静态库,将zlib编译成libz.a,然后再crtmpserver中引用。编译采用cmake的方式,crtmpserver的工程文件CMakeLists.txt中的库依赖关系如下:
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${APPS_LIBS} thelib common pthread ${TINYXML_LIBRARY_PATH} ${LUA_LIBRARY_PATH} ${OPENSSL_LIBRARY_PATH} ${CRYPTO_LIBRARY_PATH} ${Z_LIBRARY_PATH} ${DL_LIBRARY_PATH} ${AVCODEC_LIBRARY_PATH} ${AVFORMAT_LIBRARY_PATH} ${SWSCALE_LIBRARY_PATH} ${AVUTIL_LIBRARY_PATH} )编译出现错误1如下:
/home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(allformats.o): In function `av_register_all': allformats.c:(.text+0x28): undefined reference to `avcodec_register_all' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(dv.o): In function `avpriv_dv_produce_packet': dv.c:(.text+0x3ac): undefined reference to `avpriv_dv_frame_profile' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(dv.o): In function `dv_read_seek': dv.c:(.text+0xef8): undefined reference to `avpriv_dv_codec_profile' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(dv.o): In function `dv_read_header': dv.c:(.text+0x1314): undefined reference to `avpriv_dv_frame_profile' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(latmenc.o): In function `latm_write_header': latmenc.c:(.text+0x4c): undefined reference to `avpriv_mpeg4audio_get_config' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(latmenc.o): In function `latm_write_packet': latmenc.c:(.text+0x2c0): undefined reference to `avpriv_copy_bits' latmenc.c:(.text+0x2c8): undefined reference to `avpriv_align_put_bits' latmenc.c:(.text+0x490): undefined reference to `avpriv_copy_bits' latmenc.c:(.text+0x670): undefined reference to `avpriv_copy_bits' latmenc.c:(.text+0x6f0): undefined reference to `avpriv_copy_pce_data' latmenc.c:(.text+0x78c): undefined reference to `avpriv_copy_bits' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(mov.o): In function `mov_read_dac3': mov.c:(.text+0x2858): undefined reference to `avpriv_ac3_channel_layout_tab' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(mov.o): In function `mov_read_dec3': mov.c:(.text+0x33bc): undefined reference to `avpriv_ac3_channel_layout_tab' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(mov.o): In function `ff_mov_read_stsd_entries': mov.c:(.text+0x83b4): undefined reference to `av_get_bits_per_sample' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(mpegts.o): In function `mpegts_set_stream_info': mpegts.c:(.text+0x26e0): undefined reference to `avcodec_is_open' mpegts.c:(.text+0x2778): undefined reference to `avcodec_is_open' mpegts.c:(.text+0x2854): undefined reference to `avcodec_is_open' mpegts.c:(.text+0x28cc): undefined reference to `avcodec_is_open' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(mpegts.o): In function `ff_parse_mpeg2_descriptor': mpegts.c:(.text+0x43d0): undefined reference to `avcodec_is_open' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(mpegts.o):mpegts.c:(.text+0x4434): more undefined references to `avcodec_is_open' follow ......解决办法:
修改库依赖关系如下:
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${APPS_LIBS} thelib common pthread ${TINYXML_LIBRARY_PATH} ${LUA_LIBRARY_PATH} ${OPENSSL_LIBRARY_PATH} ${CRYPTO_LIBRARY_PATH} ${Z_LIBRARY_PATH} ${DL_LIBRARY_PATH} ${AVFORMAT_LIBRARY_PATH} ${AVCODEC_LIBRARY_PATH} ${SWSCALE_LIBRARY_PATH} ${AVUTIL_LIBRARY_PATH} )重新编译,出现错误2如下:
/home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(http.o): In function `http_read_header': http.c:(.text+0xb68): undefined reference to `inflateEnd' http.c:(.text+0xb7c): undefined reference to `inflateInit2_' http.c:(.text+0xb88): undefined reference to `zlibCompileFlags' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(http.o): In function `http_close': http.c:(.text+0xfcc): undefined reference to `inflateEnd' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(http.o): In function `http_read_stream': http.c:(.text+0x12c8): undefined reference to `inflate' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(id3v2.o): In function `id3v2_read_internal': id3v2.c:(.text+0x19bc): undefined reference to `uncompress' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(mov.o): In function `mov_read_cmov': mov.c:(.text+0x2f90): undefined reference to `uncompress' /home/helei/project/video/source/videoclient0.0/3rdparty/ffmpeg/install/lib/libavformat.a(rtmpproto.o): In function `rtmp_calc_swfhash': rtmpproto.c:(.text+0x2bd8): undefined reference to `inflateInit_' rtmpproto.c:(.text+0x2c10): undefined reference to `inflate' rtmpproto.c:(.text+0x2c80): undefined reference to `inflateEnd' rtmpproto.c:(.text+0x2ca4): undefined reference to `inflateEnd' collect2: ld returned 1 exit status make[2]: *** [crtmpserver/crtmpserver] Error 1 make[1]: *** [crtmpserver/CMakeFiles/crtmpserver.dir/all] Error 2 make: *** [all] Error 2 build failed解决方法:
重新调整库的依赖关系如下:
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${APPS_LIBS} thelib common pthread ${TINYXML_LIBRARY_PATH} ${LUA_LIBRARY_PATH} ${OPENSSL_LIBRARY_PATH} ${CRYPTO_LIBRARY_PATH} ${DL_LIBRARY_PATH} ${AVFORMAT_LIBRARY_PATH} ${AVCODEC_LIBRARY_PATH} ${SWSCALE_LIBRARY_PATH} ${AVUTIL_LIBRARY_PATH} ${Z_LIBRARY_PATH} )编译OK。不过没想明白,ffmpeg对zlib库有依赖,为啥要放在ffmpeg库的后面!!
相关文章推荐
- cocos2d-x3.4 交叉编译出现问题总结
- 交叉编译过程中遇到的问题总结
- 在Ubuntu下安装imx6linux系统的交叉编译环境遇到的问题总结
- net-snmp交叉编译时问题总结
- 在Ubuntu下安装imx6linux系统的交叉编译环境遇到的问题总结
- 交叉编译工具问题总结
- 交叉编译openssl-0.9.7a出现的问题总结
- 交叉编译openssl-0.9.7a出现的问题总结
- DM365/DM355的g_file_storage模拟U盘识别较慢的问题
- InstallShield12命令行模式编译工程的几点问题总结
- 交叉编译D-BUS时遇到abstract socket的问题。
- 制作交叉编译工具链的方法总结(详细)
- 建立自己的交叉编译环境(米搞定,但解决了其中出现的很多问题)
- java编译的莫名奇妙问题总结
- 制作交叉编译工具链的方法总结
- Android opencore编译问题总结
- InstallShield12命令行模式编译工程的几点问题总结---Emma友情赞助转帖
- boa 0.94.13 交叉编译的问题
- qtopia 4.2.3 移植 交叉编译记录&总结
- MIPS架构的交叉编译工具问题