centos 7.5源碼安裝freeswitch 1.10.3

一、下載freeswitch安裝包(freeswitch-1.10.2.-release.tar.gz)

二、安裝對應依賴

yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel libdb4-devel e2fsprogs-devel erlang flite-devel g722_1-devel gcc-c++ gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtheora-devel libtiff-devel libtool libuuid-devel libvorbis-devel libxml2-devel lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel openssl-devel opus-devel pcre-devel perl perl-ExtUtils-Embed pkgconfig portaudio-devel postgresql-devel python-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel wget which yasm zlib-devel libshout-devel libmpg123-devel lame-devel

  

三、安裝cmake

yum remove cmake #卸載yum安裝的版本,若無安裝則忽略
cd /usr/local/src
wget https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz
tar vzxf cmake-3.14.0.tar.gz
cd cmake-3.14.0
./configure
make
make install

四、安裝libks

cd /usr/local/src
yum install libatomic
git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make
make install

五、安裝signalwire-c

cd /usr/local/src
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c/
cmake .
make
make install
ln -sf /usr/local/lib64/pkgconfig/signalwire_client.pc /usr/lib64/pkgconfig/signalwire_client.pc

六、編譯x264

wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
tar -zxvf nasm-2.14.tar.gz
cd nasm-2.14
./configure
make
make install
cd ../x264
./configure --enable-shared --enable-static --disable-opencl
make
make install
cp /usr/local/lib/pkgconfig/x2* /usr/lib64/pkgconfig #不然libav在configure時會提示ERROR:x264 not found

七、編譯安裝mod_av

wget http://download1.rpmfusion.org/free/el/updates/7/x86_64/x/x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
wget http://download1.rpmfusion.org/free/el/updates/7/x86_64/x/x264-devel-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
rpm -hiv x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
rpm -hiv x264-devel-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
cd /usr/local/src
wget https://libav.org/releases/libav-12.3.tar.gz
tar -zxvf libav-12.3.tar.gz

須要修改源碼解決錯誤:python

libav編譯時出錯:
libavcodec/libx264.c: In function ‘X264_frame’:
libavcodec/libx264.c:246:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
if (x264_bit_depth > 8)
^
libavcodec/libx264.c:246:9: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/libx264.c: In function ‘X264_init_static’:
libavcodec/libx264.c:707:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
if (x264_bit_depth == 8)
vim libavcodec/libx264.c








c++

static av_cold void X264_init_static(AVCodec *codec)
 {
-    if (x264_bit_depth == 8)
+    if (X264_BIT_DEPTH == 8)
         codec->pix_fmts = pix_fmts_8bit;
-    else if (x264_bit_depth == 9)
+    else if (X264_BIT_DEPTH == 9)
         codec->pix_fmts = pix_fmts_9bit;
-    else if (x264_bit_depth == 10)
+    else if (X264_BIT_DEPTH == 10)
         codec->pix_fmts = pix_fmts_10bit;
}

另外還有一行使用了變量x264_bit_depth,也要替換成X264_BIT_DEPTHgit

遇到錯誤:undefined reference to x264_encoder_opengithub

註釋掉這行:sql

//x4->enc = x264_encoder_open(&x4->params);

改掉代碼後從新執行vim

tar -zxvf libav-12.3.tar.gz
./configure --enable-pic --enable-shared  --enable-libx264 --enable-gpl --extra-libs="-ldl"
make                                                                                  
make install
cp /usr/local/lib/pkgconfig/libavcodec.pc    /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavdevice.pc   /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavfilter.pc   /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavformat.pc   /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavresample.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavutil.pc     /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libswscale.pc    /usr/lib64/pkgconfig/
ldconfig  #動態連接庫管理命令,其目的爲了讓動態連接庫爲系統所共享

八、編譯freeswitch

cd /usr/local/src/
tar xvjf  freeswitch-1.10.3.-release.tar.bz2
cd freeswitch-1.10.2.-release
./configure 
make
make install
# freeswitch其默認的安裝位置是/usr/local/freeswitch

 

# 後臺啓動命令
freeswitch -nc -rp
 
# 進入命令
fs_cli
 
# 退出命令
/exit 
/bye 
等等...
 
# fs_cli報錯
fs_cli.c:1673 main() Error Connecting [] 
# 解決方法
vim /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml 
<param name="listen-ip" value="::"/>  改成 <param name="listen-ip" value="0.0.0.0"/>

  

 

 

 

 https://blog.csdn.net/weixin_43069862/article/details/105409504app

https://blog.csdn.net/tidehc/article/details/86593130curl

相關文章
相關標籤/搜索