【FFMPEG】【ARM-Linux开发】 ffmpeg 静态库使用,undefined reference错误
2016-11-24 18:51
555 查看
原文:http://blog.csdn.net/chinazjn/article/details/7954984
ffmpeg移植到dm365上,遇到undefined reference错误:
GA/gabin/lib/libavformat.a(allformats.o): In function `av_register_all':
/GA/ffmpeg-0.10/libavformat/allformats.c:53: undefined reference to `avcodec_register_all'
/GA/gabin/lib/libavformat.a(amr.o): In function `amr_read_packet':
/GA/ffmpeg-0.10/libavformat/amr.c:153: undefined reference to `av_new_packet'
/GA/ffmpeg-0.10/libavformat/amr.c:169: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(anm.o): In function `read_header':
/GA/ffmpeg-0.10/libavformat/anm.c:89: undefined reference to `av_log_ask_for_sample'
/GA/ffmpeg-0.10/libavformat/anm.c:166: undefined reference to `av_log_ask_for_sample'
/GA/gabin/lib/libavformat.a(ape.o): In function `ape_read_packet':
/GA/ffmpeg-0.10/libavformat/ape.c:372: undefined reference to `av_new_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `free_variant_list':
/GA/ffmpeg-0.10/libavformat/applehttp.c:131: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `reset_packet':
/GA/ffmpeg-0.10/libavformat/applehttp.c:151: undefined reference to `av_init_packet'
/GA/ffmpeg-0.10/libavformat/applehttp.c:151: undefined reference to `av_init_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `applehttp_read_seek':
/GA/ffmpeg-0.10/libavformat/applehttp.c:712: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `reset_packet':
网上查阅,普遍提示两种解决方法:
一、ffmpeg是纯C的库,应用程序用C++来编译。
二、路径、需要的库包含不全。
以上具体就不说了,搜索下便是。
我在无数遍仔细确认上述两种可能性后,仍然报错。郁闷了一个晚上。。
后来查阅ffmpeg的 pkg-config,终于找到原因,错误导致过程让我痛苦,原因却很简单。
错误:gcc test.c -o test -I/GA/gabin/include/ -L/GA/gabin/lib -lavcodec -lavformat -lavdevice -lavutil -pthread -ldl -lswscale -lSDL -lbz2 -lasound
-lz -lm
调整: gcc test.c -o test -I/GA/gabin/include/ -L/GA/gabin/lib -lavformat -lavdevice -lavcodec -lavutil -pthread -ldl -lswscale -lSDL -lbz2 -lasound
-lz -lm
问题解决,同志需要注意包依赖关系。
ffmpeg移植到dm365上,遇到undefined reference错误:
GA/gabin/lib/libavformat.a(allformats.o): In function `av_register_all':
/GA/ffmpeg-0.10/libavformat/allformats.c:53: undefined reference to `avcodec_register_all'
/GA/gabin/lib/libavformat.a(amr.o): In function `amr_read_packet':
/GA/ffmpeg-0.10/libavformat/amr.c:153: undefined reference to `av_new_packet'
/GA/ffmpeg-0.10/libavformat/amr.c:169: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(anm.o): In function `read_header':
/GA/ffmpeg-0.10/libavformat/anm.c:89: undefined reference to `av_log_ask_for_sample'
/GA/ffmpeg-0.10/libavformat/anm.c:166: undefined reference to `av_log_ask_for_sample'
/GA/gabin/lib/libavformat.a(ape.o): In function `ape_read_packet':
/GA/ffmpeg-0.10/libavformat/ape.c:372: undefined reference to `av_new_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `free_variant_list':
/GA/ffmpeg-0.10/libavformat/applehttp.c:131: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `reset_packet':
/GA/ffmpeg-0.10/libavformat/applehttp.c:151: undefined reference to `av_init_packet'
/GA/ffmpeg-0.10/libavformat/applehttp.c:151: undefined reference to `av_init_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `applehttp_read_seek':
/GA/ffmpeg-0.10/libavformat/applehttp.c:712: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `reset_packet':
网上查阅,普遍提示两种解决方法:
一、ffmpeg是纯C的库,应用程序用C++来编译。
二、路径、需要的库包含不全。
以上具体就不说了,搜索下便是。
我在无数遍仔细确认上述两种可能性后,仍然报错。郁闷了一个晚上。。
后来查阅ffmpeg的 pkg-config,终于找到原因,错误导致过程让我痛苦,原因却很简单。
错误:gcc test.c -o test -I/GA/gabin/include/ -L/GA/gabin/lib -lavcodec -lavformat -lavdevice -lavutil -pthread -ldl -lswscale -lSDL -lbz2 -lasound
-lz -lm
调整: gcc test.c -o test -I/GA/gabin/include/ -L/GA/gabin/lib -lavformat -lavdevice -lavcodec -lavutil -pthread -ldl -lswscale -lSDL -lbz2 -lasound
-lz -lm
问题解决,同志需要注意包依赖关系。
相关文章推荐
- 使用DDD开发ARM Linux程序
- ubuntu下使用eclipse c/c++开发arm linux程序
- 【ARM-Linux开发】TI 关于Gstreamer使用的几个参考
- 【ARM-Linux开发】Ubuntu下的/usr目录权限,导致不能使用sudo命令的修复
- 使用DDD开发ARM Linux程序
- 【ARM-Linux开发】linux下Eclipse进行C编程时动态链接库的生成和使用
- 【ARM-Linux开发】使用QT和Gstreanmer 遇到的一些问题
- 【FFMPEG】【ARM-Linux开发】fmpeg安装第三方编码器(encoder)库,ffmpeg编码h264(完)
- QT5.10开发(3) 在linux下使用编译 静态链接Qt 5.10 release版的详细过程
- Eclipse开发调试ARM裸机程序(三)C语言LED_LINUX使用DNW
- Linux 使用 ffmpeg 开发
- 转载_使用DDD+GDB开发ARM Linux程序
- 【miscellaneous】【ARM-Linux开发】ARM平台基于嵌入式Linux Gstreamer 使用
- 使用DDD+GDB开发ARM Linux程序
- 使用Eclipse开发Arm-linux程序
- 【Linux程序设计】之Linux库函数的使用,多文件程序开发,静态与共享函数
- windows下编译ffmpeg2.5——使用VS2013,ARMLINUX,ANDORID编译ffmpeg
- [ARM-Linux开发]mknod命令使用
- 【ARM-Linux开发】如何使用opkg在RicoBoard上在线安装软件包
- 【ARM-Linux开发】ti CMEM使用