Debian系统编译FreeSwitch找不到libavformat的问题

这些年来一直从事呼叫相关的产品开发,为了进一步深入学习呼叫/P2P相关的知识,最近一直在业余的时间研究freeswitch。研究开源产品,不能只是看代码,需要改改代码、编译、调试等等。
我在Debian 10上编译freeswitch, 遇到了个编译问题,花了些时间,希望遇到的朋友们,可以快速解决。
有些其他modules重新安装后,出现build error,也可以尝试重新编译freeswitch.

1. 下载Freeswitch源代码并且编译

很简单, 我就不重复写了。
https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster
参考其中“Compiling Latest Master“进行编译。

2. 编译mod_av找不到libavformat

如果你的Debian系统没有安装libavformat,  那么编译木块mod_av肯定会出问题。错误如下:
*** You must install libavformat-dev to build mod_av. Stop.

1) 在Debian系统中,安装ffmpeg就包含libavformat, 所以需要执行命令:
sudo apt-get update
sudo apt-get install ffmpeg

2) 如果安装成功请执行,ffmpeg -version查看结果。

3) 继续编译freeswitch, 执行make.
依然会遇到错误提示:*** You must install libavformat-dev to build mod_av. Stop.

4)经过学习mod_av的makefile发现,有个变量HAVE_AVFORMAT判断系统有没有安装libavformat.
这个变量的赋值是在configure.ac里面完成的:
PKG_CHECK_MODULES([AVFORMAT], [libavformat >= 53.21.1],[
AM_CONDITIONAL([HAVE_AVFORMAT],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AVFORMAT],[false])])

 所以,需要在freeswitch的代码路径下(/usr/src/freeswitch)重新执行:
./bootstrap.sh -j
./configure
make
make install

你可能感兴趣的:(开源)