我是靠谱客的博主 畅快芹菜,最近开发中收集的这篇文章主要介绍记:freeswitch-1.10.7 aarch64交叉编译1. 下载源码2. 编写交叉编译脚本build.sh3. 编译错误,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
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
最后
以上就是畅快芹菜为你收集整理的记:freeswitch-1.10.7 aarch64交叉编译1. 下载源码2. 编写交叉编译脚本build.sh3. 编译错误的全部内容,希望文章能够帮你解决记:freeswitch-1.10.7 aarch64交叉编译1. 下载源码2. 编写交叉编译脚本build.sh3. 编译错误所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复