AWS KVS(Kinesis Video Streams)之WebRTC移植编译(三)
继上一篇文章后,中途被其他事情耽误两周,现在继续。。。编译第三方库:一、【君正平台:编译usrsctp】1、下载源码git clone https://github.com/sctplab/usrsctp.git2、编译我们进入目录建一个Build/T31X/目录,并进入该目录,将编译链toolchain拷贝在该目录下执行:cmake -DCMAKE_TOOLCHAIN_FILE=./toolch
继上一篇文章后,中途被其他事情耽误两周,现在继续。。。
编译第三方库:
一、【君正平台:编译usrsctp】
1、下载源码
git clone https://github.com/sctplab/usrsctp.git
2、编译
我们进入目录建一个Build/T31X/目录,并进入该目录,将编译链toolchain拷贝在该目录下
执行:
cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain/cross-mips-linux-uclibc-gnu.cmake ../..
看到配置信息如下:
-- The C compiler identification is GNU 4.7.2
-- Check for working C compiler: /opt/ISVP/mips-gcc472-glibc216-64bit/bin/mips-linux-uclibc-gnu-gcc
-- Check for working C compiler: /opt/ISVP/mips-gcc472-glibc216-64bit/bin/mips-linux-uclibc-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- No build type selected, using DEBUG
-- Looking for include file sys/queue.h
-- Looking for include file sys/queue.h - found
-- Looking for include files sys/socket.h, linux/if_addr.h
-- Looking for include files sys/socket.h, linux/if_addr.h - found
-- Looking for include files sys/socket.h, linux/rtnetlink.h
-- Looking for include files sys/socket.h, linux/rtnetlink.h - found
-- Looking for 4 include files sys/types.h, ..., netinet/ip_icmp.h
-- Looking for 4 include files sys/types.h, ..., netinet/ip_icmp.h - found
-- Looking for include file stdatomic.h
-- Looking for include file stdatomic.h - not found
-- Looking for usrsctp.h
-- Looking for usrsctp.h - found
-- Performing Test have_sa_len
-- Performing Test have_sa_len - Failed
-- Performing Test have_sin_len
-- Performing Test have_sin_len - Failed
-- Performing Test have_sin6_len
-- Performing Test have_sin6_len - Failed
-- Performing Test have_sconn_len
-- Performing Test have_sconn_len - Failed
-- Performing Test has_wfloat_equal
-- Performing Test has_wfloat_equal - Success
-- Performing Test has_wshadow
-- Performing Test has_wshadow - Success
-- Performing Test has_wpointer_aritih
-- Performing Test has_wpointer_aritih - Success
-- Performing Test has_wunreachable_code
-- Performing Test has_wunreachable_code - Success
-- Performing Test has_winit_self
-- Performing Test has_winit_self - Success
-- Performing Test has_wno_unused_function
-- Performing Test has_wno_unused_function - Success
-- Performing Test has_wno_unused_parameter
-- Performing Test has_wno_unused_parameter - Success
-- Performing Test has_wno_unreachable_code
-- Performing Test has_wno_unreachable_code - Success
-- Performing Test has_wstrict_prototypes
-- Performing Test has_wstrict_prototypes - Success
-- Compiler flags (CMAKE_C_FLAGS): -Wall -fPIC -Wl,-Bsymbolic -lm -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -std=c99 -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wunreachable-code -Winit-self -Wno-unused-function -Wno-unused-parameter -Wno-unreachable-code -Wstrict-prototypes -Werror
-- Performing Test has_wno_address_of_packed_member
-- Performing Test has_wno_address_of_packed_member - Success
-- Performing Test has_wno_deprecated_declarations
-- Performing Test has_wno_deprecated_declarations - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/heyan/third_lib/webrtc/usrsctp/Build/T31X
之后我们执行 make
遇到如下的错误:
解决办法:
我们将usrsctp下的CMakeLists.txt中编译参数-Werror,修改为-Wno-error
继续编译,编译成功;
之后我们可以打开 usrsctp/Build/T31X/cmake_install.cmake 查看CMAKE_INSTALL_PREFIX,可以修改该CMAKE_INSTALL_PREFIX;
注:如果对Cmake不熟悉,我么可以按照如上操作,但是可以采用如下方式,解决以上问题:
编译的指令修改为:
cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain/cross-mips-linux-uclibc-gnu.cmake -DCMAKE_INSTALL_PREFIX=../../Bin/T31X -Dsctp_werror=0 ../..
3、编译生成的内容
二、【君正平台:编译libwebsockets】
1、下载源码
git clone https://github.com/warmcat/libwebsockets.git
2、进入libwebsockets
新建Build/T31X 目录
新建Library/T31X目录
将libwebsocket依赖的openssl和libevent的头文件和库都放在Library/T31X,如下:
将toolchain 放在Build/T31X 的目录中,并在该目录中执行如下脚本( ShellScript.sh):
#!/bin/bash
rm -rf CMakeCache.txt
rm -r CMakeFiles
rm -rf cmake_install.cmake
rm -rf Makefile
rm -rf CTestTestfile.cmakeif [[ "$@" =~ "-d" ]];then
echo "----------------------------cmake debug----------------------------"
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE=./toolchain/cross-mips-linux-uclibc-gnu.cmake \
-DLWS_WITHOUT_SERVER=ON \
-DLWS_WITHOUT_TESTAPPS=ON \
-DLWS_WITH_ZLIB=OFF \
-DLWS_WITHOUT_EXTENSIONS=ON \
-DLWS_WITH_ZIP_FOPS=OFF \
-DLWS_MAX_SMP=1 \
-DLWS_WITH_LIBEVENT=ON -DLWS_LIBEVENT_INCLUDE_DIRS="../../Library/T31X/include/libevent/" -DLWS_LIBEVENT_LIBRARIES="../../Library/T31X/lib/libevent.so " \
-DLWS_WITH_SSL=ON -DLWS_OPENSSL_INCLUDE_DIRS="../../Library/T31X/include" -DLWS_OPENSSL_LIBRARIES="../../Library/T31X/lib/libssl.so;../../Library/T31X/lib/libcrypto.so" \
../..
else
echo "----------------------------cmake release----------------------------"
cmake -DCMAKE_BUILD_TYPE=Release \
-DDEBUG=ON -DCMAKE_TOOLCHAIN_FILE=./toolchain/cross-mips-linux-uclibc-gnu.cmake \
-DLWS_WITHOUT_SERVER=ON \
-DLWS_WITHOUT_TESTAPPS=ON \
-DLWS_WITH_ZLIB=OFF \
-DLWS_WITHOUT_EXTENSIONS=ON \
-DLWS_WITH_ZIP_FOPS=OFF \
-DLWS_MAX_SMP=1 \
-DLWS_HAVE_HMAC_CTX_new=1 \
-DLWS_HAVE_EVP_MD_CTX_free=1\
-DLWS_WITH_LIBEVENT=ON -DLIBEVENT_INCLUDE_DIRS="../../Library/T31X/include/libevent/" -DLIBEVENT_LIBRARIES="../../Library/T31X/lib/libevent.so " \
-DLWS_WITH_SSL=ON -DOPENSSL_INCLUDE_DIR="../../Library/T31X/include" -DLWS_OPENSSL_LIBRARIES="../../Library/T31X/lib/libssl.so;../../Library/ISVP/lib/libcrypto.so" -DOPENSSL_CRYPTO_LIBRARY="../../Library/T31X/lib/libcrypto.so" -DOPENSSL_SSL_LIBRARY="../../Library/T31X/lib/libssl.so" \
../..
fimake
错误如下
解决办法:同样我们将CMakeLists.txt中的-Werror修改,或者定义DISABLE_WERROR;
【补充:】因为在后面遇到一个执行错误,详见问题描述,修改一下编译脚本,增加一个定义
3、编译成功生成如下:
在这个时候就成功了一半了,离目标越来越近,加油,,,接下来我们需要编译KVS相关的库,详细内容见下页(点击);
更多推荐
所有评论(0)