1.下载fs代码。
git clone https:
//freeswitch
.org
/stash/scm/fs/freeswitch
.git freeswitch
如果不是从官网下载,编译可能会有点问题。我是直接拷贝代码上去的。编译时,遇到的问题很多都是因为windows的回车换行问题,
dos2unix批量转化。
find . -type f -exec dos2unix {} \;
2.安装依赖
apt-get install -y autoconf git libtool g++ zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libldns-dev libedit-dev libssl-dev pkg-config yasm liblua50-dev libopus-dev libsndfile-dev libpq-dev pkg-config
apt-get install libhiredis-dev (我自己用到的hiredis)
apt-get install postgresql ( 用pg数据库时需要)
3.在fs目录代码目录中,运行
./bootstrap.sh -j
错误及原因
1、如果出下如下错误,
bootstrap: libtool not found.
You need libtool version 1.5.14 or newer to build FreeSWITCH from source.
dpkg -L libtool
发现没有/usr/bin/libtool
dpkg -l libtool
libtool 是2.4.6-0.1版本的
在ubuntu只有libtoolize,修改bootstrap.sh,
libtool=${LIBTOOL:-`${LIBDIR}/apr/build/PrintPath glibtool libtool libtool22 libtool15 libtool14 libtoolize`}
2、提示没权限的,修改对应文件为可执行
如
./bootstrap.sh: 343: ./bootstrap.sh: ./buildconf: Permission denied
./bootstrap.sh: 347: ./bootstrap.sh: ./bootstrap.sh: Permission denied
执行:chmod a+x libs/apr-util/buildconf
注意:
在libs/apr-util中执行./buildconf时,如果提示
./buildconf: 1: ./buildconf: build/get-version.sh: Permission denied
要修改libs/apr,因为get-version.sh文件是从apr这里拷贝的。
3、出现类似如下警告,不过这个不改好像也没问题
Makefile.am:54: warning: source file '$(top_srcdir)/src/zrtp.c' is in a subdirectory,
Makefile.am:54: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled. For now, the corresponding output
automake: object file(s) will be placed in the top-level directory. However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
修改Makefile.am
我修改了以下文件
vim libs/libzrtp/Makefile.am
vim libs/libdingaling/Makefile.am
vim libs/srtp/Makefile.am
vim libs/freetdm/Makefile.am
vim tests/unit/unit.mk
libs/srtp/test/Makefile.am
增加
AUTOMAKE_OPTIONS=subdir-objects
或者里面如果有AUTOMAKE_OPTIONS参数就增加subdir-objects
您的支持,是我持续创作的动力!!!!
4.生成makefile
./configure --enable-core-pgsql-support
出现如下错误
configure: creating ./config.status
config.status: creating src/include/switch_version.h.in
.in'ig.status: error: cannot find input file: `Makefile
原因时configure中的ac_config_files的赋值,出现了换行。应该是所有参数都在同一行。
实际是我configure.acj里面的换行符是windows。改成linux的,重新bootstrap.sh
5.编译 安装
make && make install
1、libs/apr-util出错
xlate/xlate.c:64:5: error: unknown type name ‘iconv_t’
iconv_t ich;
^
xlate/xlate.c: In function ‘apr_xlate_cleanup’:
xlate/xlate.c:94:22: error: ‘iconv_t’ undeclared (first use in this function)
if (old->ich != (iconv_t)-1) {
修改vim ./libs/apr-util/xlate/xlate.c,增加
#define HAVE_ICONV_H
声源:可选
make cd-sounds-install
make cd-moh-install
您的支持,是我持续创作的动力!!!!