Janus核心是WebRTC的“gateway”,它是用C语言实现而且是在libsrtp和libnice之上开发的,经过添加各类插件,能够实现不一样的功能或用例,例如SFU。官网:https://janus.conf.meetecho.com/git
在Mac下安装janusgithub
按照
https://gist.github.com/anild...
来安装web
安装流程:websocket
brew install jansson libnice openssl libusrsctp libmicrohttpd libwebsockets cmake rabbitmq-c sofia-sip opus libogg glib pkg-config gengetopt ffmpeg curl https://codeload.github.com/cisco/libsrtp/tar.gz/v2.2.0 > libsrtp-2.2.0.tar.gz tar xvf libsrtp-2.2.0.tar.gz cd libsrtp-2.2.0 ./configure --prefix=/usr/local --enable-openssl PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig make shared_library && sudo make install git clone git@github.com:meetecho/janus-gateway.git cd janus-gateway sh autogen.sh ./configure --prefix=/usr/local/janus --enable-post-processing PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig make sudo make install sudo make configs
在安装编译的时候,有如下几个报错,记录如下:app
1.sh autogen.sh的时候报错curl
autogen.sh: line 8: autoreconf: command not found
查找缘由,是由于没有安装某些工具,解决方法:socket
brew install autoconf
继续执行sh autogen.sh,报错ide
autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal -I m4 --output=aclocal.m4t Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326. autoreconf: failed to run aclocal: No such file or directory
这是须要install一个automake,执行命令:工具
brew install automake
安装完automake之后,继续执行autogen.sh,仍是有报错:oop
autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --force configure.ac:6: error: possibly undefined macro: AC_ENABLE_SHARED If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:7: error: possibly undefined macro: AC_ENABLE_STATIC autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1
看报错信息,看样子还须要安装Libtool,那就安装:
brew install Libtool
好了,继续下一步:
./configure --prefix=/usr/local/janus --enable-post-processing PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
又有报错:
configure: error: cannot find install-sh, install.sh, or shtool in . "."/.
google一下,有人已经提出了:
The problem won't go away by just installing automake/autoconf/libtool. One also needs to run 'autoreconf -i' before rerunning ./configure - it will install the missing files that ./configure is complaining about.
就是说安装这些库并不能解决这个问题,还要执行一次autoreconf -i
autoreconf -i
很顺利,而后继续执行
./configure --prefix=/usr/local/janus --enable-post-processing PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
出现如下一堆
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... ./install-sh -c -d checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes checking whether make supports the include directive... yes (GNU style) checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking whether gcc understands -c and -o together... (cached) yes checking dependency style of gcc... (cached) gcc3 checking build system type... x86_64-apple-darwin17.7.0 checking host system type... x86_64-apple-darwin17.7.0 checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 196608 checking how to convert x86_64-apple-darwin17.7.0 file names to x86_64-apple-darwin17.7.0 format... func_convert_file_noop checking how to convert x86_64-apple-darwin17.7.0 file names to toolchain format... func_convert_file_noop checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... no checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for a working dd... /bin/dd checking how to truncate binary pipes... /bin/dd bs=4096 count=1 checking for mt... no checking if : is a manifest tool... no checking for dsymutil... dsymutil checking for nmedit... nmedit checking for lipo... lipo checking for otool... otool checking for otool64... no checking for -single_module linker flag... yes checking for -exported_symbols_list linker flag... yes checking for -force_load linker flag... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... yes checking for gcc option to produce PIC... -fno-common -DPIC checking if gcc PIC flag -fno-common -DPIC works... yes checking if gcc static flag -static works... no checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin17.7.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking for pkg-config... /usr/local/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for glib-2.0 >= 2.34 libconfig nice jansson >= 2.5 libssl >= 1.0.1 libcrypto ... no configure: error: Package requirements ( glib-2.0 >= 2.34 libconfig nice jansson >= 2.5 libssl >= 1.0.1 libcrypto ) were not met: No package 'libconfig' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables JANUS_CFLAGS and JANUS_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
发现仍是有报错的,看起来是没安装这些依赖,可是brew install的时候却提示全都安装过了,通过分析脚本发现:janus是经过pkg-config匹配依赖项,在执行pkg-config查找libconfig路径时发现错误,因而须要改变一下路径:
./configure --prefix=/usr/local/janus --enable-post-processing PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig
接下来就很顺利了,make之后,测试janus是否安装成功
./janus --version
若是成功,就会出现:
Janus commit: eb703e1a53360a7f967e4d969dec957a7249e134 Compiled on: 2019? 9? 1? ??? 11?13?03? CST janus 0.7.4