我是靠谱客的博主 畅快芹菜,这篇文章主要介绍记:freeswitch-1.10.7 aarch64交叉编译1. 下载源码2. 编写交叉编译脚本build.sh3. 编译错误,现在分享给大家,希望可以做个参考。

1. 下载源码

复制代码
1
https://files.freeswitch.org/freeswitch-releases/freeswitch-1.10.7.-release.tar.gz

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

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/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)

复制代码
1
2
3
4
5
6
7
8
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,如下所示
  • 复制代码
    1
    2
    3
    4
    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)

复制代码
1
2
3
4
5
6
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,如下:
  • 复制代码
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    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报错

复制代码
1
2
3
4
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,如下所示
  • 复制代码
    1
    2
    3
    4
    5
    6
    7
    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报错

复制代码
1
2
3
4
5
6
7
8
9
10
11
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报错

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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,注释如下内容

复制代码
1
2
3
4
5
6
#applications/mod_enum #applications/mod_signalwire #codecs/mod_h26x #codecs/mod_opus #endpoints/mod_verto #languages/mod_lua

最后

以上就是畅快芹菜最近收集整理的关于记:freeswitch-1.10.7 aarch64交叉编译1. 下载源码2. 编写交叉编译脚本build.sh3. 编译错误的全部内容,更多相关记:freeswitch-1.10.7内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(75)

评论列表共有 0 条评论

立即
投稿
返回
顶部