IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 游戏开发 -> 记:freeswitch-1.10.7 aarch64交叉编译 -> 正文阅读

[游戏开发]记:freeswitch-1.10.7 aarch64交叉编译

1. 下载源码

https://files.freeswitch.org/freeswitch-releases/freeswitch-1.10.7.-release.tar.gz

2. 编写交叉编译脚本build.sh

#!/bin/bash

export ROOTDIR=$(cd `dirname $0`; pwd)

export INSTALL_PREFIX=/data/freeswitch2
export EXTERNAL_PREFIX=/data/ext-freeswitch2
export TCHAIN_PREFIX=/opt/aarch64/aarch64-buildroot-linux-gnu/sysroot
export TCHAIN=${TCHAIN_PREFIX}/../../bin/aarch64-linux

export CC="${TCHAIN}-gcc"
export CXX="${TCHAIN}-g++"
export AR=${TCHAIN}-ar
export LD=${TCHAIN}-ld

export CFLAGS=" \
    -O2 -g \
    -DGRANDSTREAM_NETWORKS \
    -DHAVE_NETINET_IN_H \
    -DSWITCH_DEBUG_RWLOCKS \
    -Wno-error \
    -Wno-pedantic \
    -Wno-unused-value \
    -Wno-error=pedantic \
    -Wno-error=attributes \
    -Wno-error=unused-value \
    -Wno-error=sequence-point \
    -Wno-error=unused-variable \
    -Wno-error=unused-but-set-variable \
    -Wno-error=declaration-after-statement \
    -DHAVE_PTHREAD_MUTEX_RECURSIVE \
    -I${TCHAIN_PREFIX}/usr/include \
    -I${TCHAIN_PREFIX}/usr/include/uuid \
    -I${TCHAIN_PREFIX}/../../include \
    -I${TCHAIN_PREFIX}/usr/include/glib-2.0/glib \
    -I${TCHAIN_PREFIX}/usr/lib/glib-2.0/include \
    -I${EXTERNAL_PREFIX}/include \
    -I${INSTALL_PREFIX}/include \
    -I${INSTALL_PREFIX}/include \
    -I${INSTALL_PREFIX}/include/sofia-sip-1.13"

export CXXFLAGS="${CFLAGS}"

export CPPFLAGS="${CFLAGS}"

export LDFLAGS=" \
    -L${TCHAIN_PREFIX}/usr/lib \
    -L${TCHAIN_PREFIX}/usr/lib64 \
    -L${EXTERNAL_PREFIX}/lib \
    -L${INSTALL_PREFIX}/lib \
    -Wl,-rpath=${INSTALL_PREFIX}/lib \
    -Wl,-rpath-link=${INSTALL_PREFIX}/lib \
    -Wl,-rpath-link=${TCHAIN_PREFIX}/usr/lib \
    -Wl,-rpath-link=${TCHAIN_PREFIX}/usr/lib64 \
    -Wl,-rpath-link=${EXTERNAL_PREFIX}/lib"

export PKG_CONFIG_PATH="${INSTALL_PREFIX}/lib/pkgconfig:${TCHAIN_PREFIX}/usr/lib/pkgconfig:${TCHAIN_PREFIX}/usr/lib64/pkgconfig:${EXTERNAL_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export FONTCONFIG_CFLAGS=" \
    -I${TCHAIN_PREFIX}/usr/include \
    -I${TCHAIN_PREFIX}/../../include \
    -I${TCHAIN_PREFIX}/usr/include/uuid \
    -I${EXTERNAL_PREFIX}/include"
export FONTCONFIG_LIBS=" \
    -L${TCHAIN_PREFIX}/usr/lib \
    -L${TCHAIN_PREFIX}/usr/lib64 \
    -L${EXTERNAL_PREFIX}/lib"

./rebootstrap.sh
./configure \
    --prefix=${INSTALL_PREFIX} \
    --build=aarch64-linux-gnu \
    --host=aarch64-linux \
    --target=aarch64-linux-gnu \
    --with-openssl=${INSTALL_PREFIX} \
    --without-png \
    --disable-srtp \
    --disable-libvpx \
    --without-freetype \
    ac_cv_file__dev_ptmx=yes \
    ac_cv_file__dev_urandom=yes \
    ac_cv_func_setpgrp_void=yes \
    ac_cv_file__dev_zero=yes \
    ac_cv_func_malloc_0_nonnull=yes \
    ac_cv_func_realloc_0_nonnull=yes \
    ac_cv_tcp_nodelay_inherited=yes \
    enable_core_odbc_support=no \
    ac_cv_func_pthread_rwlock_init=yes //解决apr库中读写锁操作检查失败,导致移植成功后不能处理呼叫问题

3. 编译错误

3.1. apr报错(1)

checking 3rd argument to the gethostbyname_r routines... char
checking if TCP_NODELAY setting is inherited from listening sockets... (cached) yes
checking if O_NONBLOCK setting is inherited from listening sockets... yes
checking whether TCP_NODELAY and TCP_CORK can both be enabled... configure: error: in `/root/project/voip/freeswitch-1.10.7/libs/apr':
configure: error: cannot run test program while cross compiling
See `config.log' for more details
configure: error: ./configure.gnu failed for libs/apr
  • vim?libs/apr/configure.ac,注释掉APR_CHECK_TCP_NODELAY_INHERITED和APR_CHECK_TCP_NODELAY_WITH_CORK,如下所示
  • 1960 #APR_CHECK_TCP_NODELAY_INHERITED
    1961 APR_CHECK_O_NONBLOCK_INHERITED
    1962 #APR_CHECK_TCP_NODELAY_WITH_CORK
    
  • 重新运行build.sh脚本

3.2. apr报错(2)

network_io/unix/sockets.c: In function ‘apr_socket_accept’:
network_io/unix/sockets.c:234:30: error: #if with no expression
 #if APR_TCP_NODELAY_INHERITED
                              ^
/root/project/voip/freeswitch-1.10.7/libs/apr/build/apr_rules.mk:201: recipe for target 'network_io/unix/sockets.lo' failed
  • 修改libs/apr/include/apr.h.in,注释APR_TCP_NODELAY_INHERITED,如下:
  • 245 #define APR_TCP_NOPUSH_FLAG       @apr_tcp_nopush_flag@
    246 
    247 /* Is the TCP_NODELAY socket option inherited from listening sockets?
    248 */
    249 //#define APR_TCP_NODELAY_INHERITED @tcp_nodelay_inherited@                                                                                                                                                                             
    250 
    251 /* Is the O_NONBLOCK flag inherited from listening sockets?
    252 */
    253 #define APR_O_NONBLOCK_INHERITED @o_nonblock_inherited@
  • 重新执行build.sh脚本

3.3.?apr-util报错

checking for libpq-fe.h... no
checking for dbd/apr_dbd_mysql.c... configure: error: cannot check for file existence when cross compiling
configure: error: ./configure.gnu failed for libs/apr-util
  • 修改libs/apr-util/configure.ac,注释APU_CHECK_DBD_MYSQL,如下所示
  • 124 APU_CHECK_DBM
    125 APU_CHECK_DBD
    126 #APU_CHECK_DBD_MYSQL                                                                                                                                                                                                                    
    127 APU_CHECK_DBD_SQLITE3
    128 APU_CHECK_DBD_SQLITE2
    129 APU_FIND_EXPAT
    130 APU_FIND_ICONV
  • 重新执行build.sh

3.4.?switch_core_media.c报错

src/switch_core_media.c: In function ‘switch_core_media_add_crypto’:
src/switch_core_media.c:1396:2: error: unknown type name ‘bool’
  bool multiple_keys = false;
  ^~~~
src/switch_core_media.c:1396:23: error: ‘false’ undeclared (first use in this function)
  bool multiple_keys = false;
                       ^~~~~
src/switch_core_media.c:1396:23: note: each undeclared identifier is reported only once for each function it appears in
src/switch_core_media.c:1490:20: error: ‘true’ undeclared (first use in this function)
    multiple_keys = true;
  • 添加#include <stdbool.h>头文件即可

3.5.?src/switch_rtp.c报错

make  all-recursive
make[1]: Entering directory '/Asterisk/project/voip/freeswitch-1.10.7'
  CC       src/libfreeswitch_la-switch_core_media.lo
  CC       src/libfreeswitch_la-switch_rtp.lo
In file included from /root/project/voip/freeswitch-1.10.7/libs/srtp/crypto/include/datatypes.h:49:0,
                 from /root/project/voip/freeswitch-1.10.7/libs/srtp/crypto/include/rdbx.h:50,
                 from /root/project/voip/freeswitch-1.10.7/libs/srtp/include/srtp_priv.h:52,
                 from src/switch_rtp.c:49:
/root/project/voip/freeswitch-1.10.7/libs/srtp/crypto/include/integers.h:100:16: error: conflicting types for ‘uint64_t’
 typedef double uint64_t;
                ^~~~~~~~
In file included from /opt/rk3328/rk64bit/aarch64-buildroot-linux-gnu/sysroot/usr/include/stdint.h:37:0,
                 from /opt/rk3328/rk64bit/lib/gcc/aarch64-buildroot-linux-gnu/6.4.0/include/stdint.h:9,
                 from /opt/rk3328/rk64bit/aarch64-buildroot-linux-gnu/sysroot/usr/include/inttypes.h:27,
                 from ./src/include/switch_platform.h:122,
                 from ./src/include/switch.h:112,
                 from src/switch_rtp.c:34:
/opt/rk3328/rk64bit/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/stdint-uintn.h:27:20: note: previous declaration of ‘uint64_t’ was here
 typedef __uint64_t uint64_t;
                    ^~~~~~~~
In file included from /opt/aarch64/aarch64-buildroot-linux-gnu/sysroot/usr/include/arpa/inet.h:22:0,
                 from ./src/include/switch_platform.h:124,
                 from ./src/include/switch.h:112,
                 from src/switch_rtp.c:34:
src/switch_rtp.c: In function ‘rtcp_generate_sender_info’:
src/switch_rtp.c:1857:62: error: invalid operands to binary << (have ‘double’ and ‘int’)
  sr->ntp_lsw = htonl((u_long)(ntp_usec*(double)(((uint64_t)1)<<32)*1.0e-6)); /* convert microseconds to fraction of 32bits and store result in "least significatn word" */
                                                 ~~~~~~~~~~~~~^
Makefile:2412: recipe for target 'src/libfreeswitch_la-switch_rtp.lo' failed
make[1]: *** [src/libfreeswitch_la-switch_rtp.lo] Error 1
make[1]: Leaving directory '/Asterisk/project/voip/freeswitch-1.10.7'
  • 将libs/srtp/crypto/include/integers.h中typedef double uint64_t;修改为:typedef unsigned long uint64_t;

3.6. 修改modules.conf,注释如下内容

#applications/mod_enum
#applications/mod_signalwire
#codecs/mod_h26x
#codecs/mod_opus
#endpoints/mod_verto
#languages/mod_lua

  游戏开发 最新文章
6、英飞凌-AURIX-TC3XX: PWM实验之使用 GT
泛型自动装箱
CubeMax添加Rtthread操作系统 组件STM32F10
python多线程编程:如何优雅地关闭线程
数据类型隐式转换导致的阻塞
WebAPi实现多文件上传,并附带参数
from origin ‘null‘ has been blocked by
UE4 蓝图调用C++函数(附带项目工程)
Unity学习笔记(一)结构体的简单理解与应用
【Memory As a Programming Concept in C a
上一篇文章      下一篇文章      查看所有文章
加:2022-03-30 18:59:49  更:2022-03-30 19:00:00 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/23 20:13:36-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码