1.1、升级boost库,我升级的版本1.65.0,解决后面编译找不到宏定义错误,boost库需要手动编译,网上一大坨。
1.2、安装按各种依赖库,通过yum安装即可,libevent、libevent-devel、gettext-devel、libsigc++20、libsigc++20-devel、glibmm24-devel、glibmm24、libvpx-devel、libvpx、libvpx-utils。如果已经安装则忽略
1.3、gstreamer,kurento依赖gstreamer,所以需要手动编译这个库,具体参考如下篇章
gstreamer依赖了gobject-introspection,centos默认安装不支持PyUnicodeUCS4_DecodeUTF8,需要手动编译
=================================错误信息======================================= make[4]: Entering directory `/root/kurento/deps/gstreamer/gst' GEN Gst-1.0.gir Traceback (most recent call last): File "/usr/bin/g-ir-scanner", line 53, in <module> from giscanner.scannermain import scanner_main File "/usr/lib64/gobject-introspection/giscanner/scannermain.py", line 35, in <module> from giscanner.dumper import compile_introspection_binary File "/usr/lib64/gobject-introspection/giscanner/dumper.py", line 28, in <module> from .gdumpparser import IntrospectionBinary File "/usr/lib64/gobject-introspection/giscanner/gdumpparser.py", line 31, in <module> from .transformer import TransformerException File "/usr/lib64/gobject-introspection/giscanner/transformer.py", line 28, in <module> from .girparser import GIRParser File "/usr/lib64/gobject-introspection/giscanner/girparser.py", line 26, in <module> from .girwriter import COMPATIBLE_GIR_VERSION File "/usr/lib64/gobject-introspection/giscanner/girwriter.py", line 25, in <module> from .xmlwriter import XMLWriter File "/usr/lib64/gobject-introspection/giscanner/xmlwriter.py", line 36, in <module> from giscanner._giscanner import collect_attributes ImportError: /usr/lib64/gobject-introspection/giscanner/_giscanner.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8 make[4]: *** [Gst-1.0.gir] Error 1 make[4]: Leaving directory `/root/kurento/deps/gstreamer/gst' ====================================解决方案==================================== git clone https://gitlab.gnome.org/GNOME/gobject-introspection.git git checkout 1.56.1 -b 1.56.1 ./configure --with-python=/usr/local/python2.7.15/bin --prefix=/usr/local/gobject-introspection make && make install
比较多,但是还是比较好编译的,将下面的组件都编译一下就可以,必须先编译gstreamer。
需要指定gobject-introspection路径,因此需要声明
export PKG_CONFIG_PATH=/usr/local/gobject-introspection/lib/pkgconfig/:$PKG_CONFIG_PATH
我这里使用的版本1.14.0,因为kurento最低要求是1.14.0
gstreamer、gst-plugins-base、gst-plugins-bad、 gst-plugins-good 、gst-plugins-ugly、gst-rtsp-server、gst-editing-services、gst-libav
我是按照这个顺序编译的,当然可以只编译出gstreamer,后面缺少什么依赖在回过头编译也是可以的,注意必须要声明export。
我编译的kurento是当前最新稳定版本,6.16.0,编译顺序,kurento-module-creator -> kms-cmake-utils -> kms-jsonrpc -> kms-core -> kurento-media-server
这个是一个java工程,用到了maven,编译结束后执行cp命令,拷贝到相应目录中,注意,我这里的cmake是2.8版本,根据各自环境进行变更
[root@63d5c0084f5b kurento-module-creator]# ls debian LICENSE NOTICE pom.xml README.md scripts src [root@63d5c0084f5b kurento-module-creator]# mvn clean install -bash: mvn: command not found [root@63d5c0084f5b kurento-module-creator]# . ~/.bash_profile [root@63d5c0084f5b kurento-module-creator]# mvn clean install [INFO] Scanning for projects... Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-file/1.0/wagon-file-1.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-file/1.0/wagon-file-1.0.pom (1.4 kB at 891 B/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-providers/1.0/wagon-providers-1.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-providers/1.0/wagon-providers-1.0.pom (2.1 kB at 5.0 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/1.0/wagon-1.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/1.0/wagon-1.0.pom (9.8 kB at 23 kB/s) ........ ........ ........ ==========================================编译结束后=================================== cp ./target/kurento-module-creator-jar-with-dependencies.jar /usr/bin cp ./scripts/kurento-module-creator /usr/bin cp ./target/classes/FindKurentoModuleCreator.cmake /usr/local/share/cmake-2.8/Modules/
编译没有遇到错误,如下是执行的命令
git clone https://github.com/Kurento/kms-cmake-utils.git git checkout 6.16.0 -b 6.16.0 mkdir build cd build/ cmake .. make make install
kms-jsonrpc依赖了jsoncpp,这里jsoncpp是Kurento仓库内的
git clone https://github.com/Kurento/jsoncpp.git git checkout 1.6.4 -b 1.6.4 修改CMakeLists.txt,增加-fPIC set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -Wall -Wextra -pedantic") 编译并安装 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/local/gobject-introspection/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake-2.8/Modules/ .. make && make install
kms-core是核心模块,编译出这个就成功了一大半了
yum install http://repo.okay.com.mx/centos/7/x86_64/release/okay-release-1-1.noarch.rpm yum update --nogpgcheck automake
由于centos默认的gcc版本比较低,不支持c++14,不想自己升级gcc了,所以直接修改cmake文件,将gnu++14修改成gnu++11
修改cmake文件, 将gnu++14 --> gnu++11 /usr/local/share/cmake-2.8/Modules/CommonBuildFlags.cmake set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall -pthread ${DPKG_CXXFLAGS}")
由于kurento里面gstreamer版本是1.5,但是在centos编译出来的gstreamer,无论是什么版本都是以1.0结尾,所以我们需要将CMakeList.txt中 gstreamer-1.5 ---> 全部修改成 gstreamer-1.0。后面编译过程中如果出现了1.5就改成1.0,肯定没有用问题。
编译kms-core解决gstreamer-1.5 not found /root/kurento/kms-core/CMakeLists.txt
当编译的时候,缺少什么第三方依赖,就安装就好,这里主要是gstreamer的依赖。将gstreamer-1.5 修改成 gstream-1.0
git clone https://github.com/Kurento/kms-core.git git checkout 6.16.0 -b 6.16.0 mkdir build && cd build cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake-2.8/Modules/ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DVPX_INCLUDE_DIRS=/root/kurento/kms-core/src/gst-plugins/vp8parse \ -DVPX_LIBRARIES=/root/kurento/kms-core/src/gst-plugins/vp8parse .. make && make install
如果编译错误,应该就是缺少第三方库,缺什么就编译什么,肯定没有问题的。
kurento-media-server依赖了websocket,所以需要编译一下,我这里边使用最新稳定版本0.8.2
git clone https://github.com/zaphoyd/websocketpp.git git checkout 0.8.2 进行编译安装 mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=/usr .. make && make install
如果websocket使用的0.7.0,则不需要修改CMakeLists.txt
修改kurento-media-server 文件 vi ../server/transport/websocket/CMakeLists.txt 将版本0.7.0 修改成0.8.2
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/local/gobject-introspection/lib/pkgconfig/:$PKG_CONFIG_PATH git clone https://github.com/worker24h/kurento-media-server.git git checkout 6.16.0 -b 6.16.0 mkdir builid && cd build cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake-2.8/Modules/ \ -DCMAKE_C_FLAGS="-I /usr/include/gstreamer-1.0/ -I /usr/include/glib-2.0/ \ -I /usr/lib64/glib-2.0/include/" -DCMAKE_CXX_FLAGS="-I /usr/include/gstreamer-1.0/ \ -I /usr/include/glib-2.0/ -I /usr/lib64/glib-2.0/include/" .. make && make install
在编译到最后,出现一个连接错误,这个是缺少符号表,应该是缺少某个库,经过排查发现没有连接gstpbutils,如果应该按照前面gstreamer所有组件都安装了,那么系统中肯定会有,最简单的方式,就是手动编译,把库添加进去即可。
[ 60%] Building CXX object server/CMakeFiles/kurento-media-server.dir/ResourceManager.cpp.o [ 66%] Building CXX object server/CMakeFiles/kurento-media-server.dir/RequestCache.cpp.o [ 73%] Building CXX object server/CMakeFiles/kurento-media-server.dir/CacheEntry.cpp.o [ 80%] Building CXX object server/CMakeFiles/kurento-media-server.dir/logging.cpp.o [ 86%] Building CXX object server/CMakeFiles/kurento-media-server.dir/modules.cpp.o [ 93%] Building CXX object server/CMakeFiles/kurento-media-server.dir/loadConfig.cpp.o [100%] Building CXX object server/CMakeFiles/kurento-media-server.dir/death_handler.cpp.o Linking CXX executable kurento-media-server /usr/local/lib64/libkmscoreimpl.so: undefined reference to `gst_video_event_is_force_key_unit' /usr/local/lib64/libkmsgstcommons.so: undefined reference to `gst_encoding_video_profile_new' /usr/local/lib64/libkmscoreimpl.so: undefined reference to `gst_video_event_new_upstream_force_key_unit' /usr/local/lib64/libkmsgstcommons.so: undefined reference to `gst_encoding_container_profile_add_profile' /usr/local/lib64/libkmsgstcommons.so: undefined reference to `gst_encoding_audio_profile_new' /usr/local/lib64/libkmsgstcommons.so: undefined reference to `gst_encoding_container_profile_new' collect2: error: ld returned 1 exit status make[2]: *** [server/kurento-media-server] Error 1 make[1]: *** [server/CMakeFiles/kurento-media-server.dir/all] Error 2 make: *** [all] Error 2 [root@63d5c0084f5b build]# ==================解决方案===================== 这个错误显然是没有找到符号表,通过分析编译的时候没有找到gstpbutils库,因为这是最后一步,所以我们可以手动编译,添加上依赖库-lgstpbutils-1.0 命令如下: cd /root/kurento/kurento-media-server/build/server /usr/bin/c++ -I /usr/include/gstreamer-1.0/ -I /usr/include/glib-2.0/ -I /usr/lib64/glib-2.0/include/ \ -std=gnu++11 -Wall -pthread -Wno-old-style-cast -Wno-error=deprecated -DGST_DISABLE_DEPRECATED -DHAVE_CONFIG_H \ -pie CMakeFiles/kurento-media-server.dir/main.cpp.o \ CMakeFiles/kurento-media-server.dir/version.cpp.o CMakeFiles/kurento-media-server.dir/ServerMethods.cpp.o \ CMakeFiles/kurento-media-server.dir/ResourceManager.cpp.o CMakeFiles/kurento-media-server.dir/RequestCache.cpp.o \ CMakeFiles/kurento-media-server.dir/CacheEntry.cpp.o CMakeFiles/kurento-media-server.dir/logging.cpp.o \ CMakeFiles/kurento-media-server.dir/modules.cpp.o CMakeFiles/kurento-media-server.dir/loadConfig.cpp.o \ CMakeFiles/kurento-media-server.dir/death_handler.cpp.o -o kurento-media-server \ -rdynamic -lboost_filesystem -lboost_regex -lboost_system -lboost_thread \ -lboost_program_options -lboost_unit_test_framework -lboost_log transport/libtransport.a \ -ldl transport/websocket/libwebsocketTransport.a -lssl -lcrypto -lgstreamer-1.0 -lgobject-2.0 \ -lglib-2.0 /usr/local/lib64/libkmscoreimpl.so /usr/local/lib64/libkmsgstcommons.so \ -lgstsdp-1.0 /usr/local/lib64/libjsonrpc.so -lkmsjsoncpp -lsigc-2.0 -lgstpbutils-1.0 \ -lglibmm-2.4 -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 /usr/local/lib64/libkmscoreimpl.so \ /usr/local/lib64/libkmsgstcommons.so -lgstsdp-1.0 /usr/local/lib64/libjsonrpc.so -lkmsjsoncpp \ -lsigc-2.0 -lglibmm-2.4 -lboost_filesystem -lboost_regex -lboost_system -lboost_thread \ -Wl,-rpath,/usr/local/lib64
kurento的编译,虽然要编译的组件比较多,但是整体来说不是很难,有一些坑已经填好,避免大家再走弯路。