FreeSwitch 1.10.9 在CentOS7.9编译spandsp,V18_MODE_5BIT_4545错误

文章讲述了在CentOS7.9系统上编译FreeSwitch的mod_spandsp模块时遇到的错误,错误源于spandsp库的版本不兼容。解决方法是通过git回退到特定版本的spandsp代码,重新编译并安装。

这篇文章资料来自于网络,对部分知识整理,这里只是记录一下,仅供参考。

        最近FreeSwitch 1.10.9 在CentOS7.9编译mod_spandsp出问题,

making all mod_spandsp
make[4]: Entering directory `/usr/local/src/freeswitch-1.10.9.-release/src/mod/applications/mod_spandsp'
  CC       mod_spandsp_la-mod_spandsp.lo
  CC       mod_spandsp_la-udptl.lo
  CC       mod_spandsp_la-mod_spandsp_fax.lo
  CC       mod_spandsp_la-mod_spandsp_dsp.lo
mod_spandsp_dsp.c: In function ‘get_v18_mode’:
mod_spandsp_dsp.c:159:10: error: ‘V18_MODE_5BIT_4545’ undeclared (first use in this function)
  int r = V18_MODE_5BIT_4545;
          ^
mod_spandsp_dsp.c:159:10: note: each undeclared identifier is reported only once for each function it appears in
mod_spandsp_dsp.c:165:8: error: ‘V18_MODE_5BIT_50’ undeclared (first use in this function)
    r = V18_MODE_5BIT_50;
        ^
mod_spandsp_dsp.c: In function ‘spandsp_tdd_send_session’:
mod_spandsp_dsp.c:216:2: error: too few arguments to function ‘v18_init’
  tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
  ^
In file included from /usr/local/include/spandsp.h:111:0,
                 from mod_spandsp.h:50,
                 from mod_spandsp_dsp.c:36:
/usr/local/include/spandsp/v18.h:138:29: note: declared here
 SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
                             ^
mod_spandsp_dsp.c: In function ‘spandsp_tdd_encode_session’:
mod_spandsp_dsp.c:263:2: error: too few arguments to function ‘v18_init’
  pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
  ^
In file included from /usr/local/include/spandsp.h:111:0,
                 from mod_spandsp.h:50,
                 from mod_spandsp_dsp.c:36:
/usr/local/include/spandsp/v18.h:138:29: note: declared here
 SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
                             ^
mod_spandsp_dsp.c: In function ‘spandsp_tdd_decode_session’:
mod_spandsp_dsp.c:341:2: error: too few arguments to function ‘v18_init’
  pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt);
  ^
In file included from /usr/local/include/spandsp.h:111:0,
                 from mod_spandsp.h:50,
                 from mod_spandsp_dsp.c:36:
/usr/local/include/spandsp/v18.h:138:29: note: declared here
 SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
                             ^
make[4]: *** [mod_spandsp_la-mod_spandsp_dsp.lo] Error 1
make[4]: Leaving directory `/usr/local/src/freeswitch-1.10.9.-release/src/mod/applications/mod_spandsp'
make[3]: *** [mod_spandsp-all] Error 1
make[3]: Leaving directory `/usr/local/src/freeswitch-1.10.9.-release/src/mod'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/freeswitch-1.10.9.-release/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/freeswitch-1.10.9.-release'
make: *** [all] Error 2

原因:

        由于FreeSwitch依赖spandsp,而spandsp库在不断更新和提交,所以出现版本不兼容的问题。

解决方式:

        回退到匹配版本。

        


git clone https://github.com/freeswitch/spandsp.git
cd spandsp
git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4

./bootstrap.sh -j
./configure
make
make install

解决问题。https://github.com/freeswitch/spandsp/archive/0d2e6ac65e0e8f53d652665a743015a88bf048d4.zip

### 安装和配置 FreeSWITCH 1.10.9 #### 准备工作 为了确保顺利安装 FreeSWITCH,在开始之前需更新系统并安装必要的依赖包。 ```bash sudo yum update -y sudo yum groupinstall "Development Tools" -y sudo yum install epel-release -y sudo yum install autoconf automake libtool curl openssl-devel ncurses-devel pkgconfig zlib-devel sqlite-devel bzip2-devel pcre-devel uuid-devel libjpeg-turbo-devel speexdsp-devel sox-devel gsm-devel lua-devel python-devel perl-devel tcl-devel jack-audio-connection-kit-devel alsa-lib-devel gtk3-devel jansson-devel yaml-cpp-devel hiredis-devel redis --skip-broken -y ``` #### 安装 NASM NASM 是汇编器,对于某些模块的编译至关重要。 ```bash wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz tar -xvf nasm-2.14.tar.gz cd nasm-2.14 ./configure make sudo make install ``` #### 编译 SpandspSpandsp 提供传真和其他功能的支持,是 FreeSWITCH 的重要组成部分。 ```bash git clone https://github.com/freeswitch/spandsp.git cd spandsp git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4 ./bootstrap.sh -j ./configure make sudo make install ``` #### 下载与编译 FreeSWITCH 获取最新版本源码,并按照官方指南进行编译安装。 ```bash cd /usr/src/ git clone http://github.com/signalwire/freeswitch.git freeswitch cd freeswitch ./bootstrap.sh -j ./configure make sudo make install sudo make sounds-install moh-install cdrom-install ``` #### 配置服务启动项 设置软连接以便命令行调用更方便,并配置为开机自启。 ```bash sudo ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/ sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/ cp -r /usr/local/freeswitch/bin/freeswitch /etc/rc.d/init.d/ echo -e "/etc/init.d/freeswitch -nonat -nc" >> /etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local ``` 完成上述操作后即可成功部署 FreeSWITCH 1.10.9 版本[^1][^2][^3][^4]。
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值