一.如果编译时报找不到库文件的错误:
/usr/bin/ld: warning: libswresample.so.3, needed by /usr/local/ffmpeg/lib/libavcodec.so, not found (try using -rpath or -rpath-link)
原因:
Makefile里指定了链接库的路径,但是在此路径下没找到;
-L /usr/local/ffmpeg/lib -lavformat -lavcodec -lavutil -lswscale
解决:
添加链接库的环境变量:
sudo vim /etc/profile
在后面添加:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ffmpeg/lib
保存后source一下:
source /etc/profile
检查:
aston@ubuntu:/mnt/hgfs/share/source_insight/main_17/MainCode$ echo $LD_LIBRARY_PATH
:/usr/local/ffmpeg/lib
二:ortp库安装后运行程序时报如下错误:
aston@ubuntu:/mnt/hgfs/share/source_insight/main_86/mainCode1/test1/recv$ ./rtprecv
./rtprecv: error while loading shared libraries: libortp.so.9: cannot open shared object file: No such file or directory
原因:连接时找不到动态库导致的;
解决:
1.查看如下路径下是否存在ortp库的配置文件;
$ ls /etc/ld.so.conf.d
2.如果不存在则创建,并写入ortp库的路径即可:
在ortp.conf文件中写入如下路径:
/home/aston/workplace/ortp/ortp-0.24.2/install/lib
3.重新配置下链接库:
sudo ldconfig
重新运行程序即可