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
您的支持,是我持續創作的動力!!!!