当前位置: 首页 > article >正文

交叉编译avahi到aarch64平台

谢绝转载

一、背景

         准备学习无中心网络组网,研究如何实现无中心网络IP分配

二、环境搭建过程

找到的有参考价值的网页:

https://zhuanlan.zhihu.com/p/60892150322

gcc_7.5.sh

#! /bin/sh

export PATH=/home/ws/chain_tools/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin:$PATH
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-

2.1 expat-2.6.4 交叉编译

编译包下载路径:

https://sourceforge.net/projects/expat/files/expat/2.6.4/expat-2.6.4.tar.xz/download

#! /bin/bash
cd ./expat-2.6.4/

source ~/env/gcc_7.5.sh

./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ --prefix=$(pwd)/../expat_install --enable-shared --enable-static

make -j20
make install

# /home/ws/github/avahi/expat_install/bin
# /home/ws/github/avahi/expat_install/include
# /home/ws/github/avahi/expat_install/lib
# /home/ws/github/avahi/expat_install/share

2.2 libdaemon-0.14 交叉编译

编译包下载路径:https://0pointer.de/lennart/projects/libdaemon/#download

export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
./configure  --host=aarch64-linux-gnu --prefix=$(pwd)/../libdaemon_install  --config-cache
#--enable-shared --enable-static
make -j20
make install

# /home/ws/github/avahi/libdaemon_install/include
# /home/ws/github/avahi/libdaemon_install/lib
# /home/ws/github/avahi/libdaemon_install/share

遇到编译过错中报错不识别aarch64平台的问题,解决方式如下:

wget -O ./config.sub "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
wget -O ./config.guess "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
chmod +x config.guess config.sub

echo "ac_cv_func_setpgrp_void=yes" > config.cache

# 在编译参数中增加 --config-cache
# ./configure --host=aarch64-linux-gnu --prefix=$(pwd)/build-aarch64 --config-cache

2.3 dbus-1.3.0 交叉编译

源码下载路径:Index of /releases/dbus

#! /bin/bash
cd ./dbus-1.3.0/

source ~/env/gcc_7.5.sh


# export CC=aarch64-linux-gnu-gcc
# export CXX=aarch64-linux-gnu-g++
./configure --prefix=$(pwd)/../dbus1.3.0_install --enable-tests=no --host=aarch64-linux-gnu --disable-selinux CFLAGS="-I/home/ws/github/avahi/expat_install/include" LDFLAGS="-L/home/ws/github/avahi/expat_install/lib"

#--enable-shared --enable-static
make -j20
make install

2.4 avahi交叉编译

源码下载路径,注意要切换tag到v0.8分支:GitHub - avahi/avahi at v0.8

#! /bin/bash
cd ./avahi/

# sudo apt-get install autoconf automake libtool
# sudo apt install gettext
# sudo apt-get install libdbus-1-dev
# sudo apt-get install libglib2.0-dev
# sudo apt-get install libexpat1-dev

source ~/env/gcc_7.5.sh

./autogen.sh

# 设置环境变量
export CPPFLAGS="-I/home/ws/github/avahi/expat_install/include -I/home/ws/github/avahi/dbus1.3.0_install/include/dbus-1.0/dbus"
export CFLAGS="-I/home/ws/github/avahi/expat_install/include -I/home/ws/github/avahi/dbus1.3.0_install/include/dbus-1.0/dbus"
export LDFLAGS="-L/home/ws/github/avahi/expat_install/lib -L/home/ws/github/avahi/dbus1.3.0_install/lib -Wl,-rpath-link,/home/ws/github/avahi/dbus1.3.0_install/lib -Wl,-rpath,/home/ws/github/avahi/dbus1.3.0_install/lib"
export LIBS="-ldbus-1 -lpthread -lrt"
export PKG_CONFIG_PATH="/home/ws/github/avahi/dbus1.3.0_install/lib/pkgconfig"
export PKG_CONFIG_LIBDIR="/home/ws/github/avahi/dbus1.3.0_install/lib"

# 配置 Avahi
./configure --host=aarch64-linux-gnu \
    --prefix=$(pwd)/build-aarch64 \
    --with-distro=archlinux \
    --localstatedir=$(pwd)/log \
    --with-xml=none \
    --with-avahi-user=root \
    --with-avahi-group=root \
    --disable-qt3 --disable-qt4 --disable-qt5  --disable-gtk --disable-gtk3 --disable-python --disable-mono --disable-pygobject \
    --disable-doxygen  --disable-manpages  --disable-libevent --disable-FEATURE --disable-glib --disable-gobject \
    --disable-daemon --disable-dnsconfd --disable-utils --disable-gdbm \
    --enable-autoipd \
    DBUS_CFLAGS="-I/home/ws/github/avahi/dbus1.3.0_install/include/dbus-1.0 -I/home/ws/github/avahi/dbus1.3.0_install/lib/dbus-1.0/include" \
    DBUS_LIBS="-L/home/ws/github/avahi/dbus1.3.0_install/lib -ldbus-1 -lpthread -lrt -Wl,-rpath-link,/home/ws/github/avahi/dbus1.3.0_install/lib -Wl,-rpath,/home/ws/github/avahi/dbus1.3.0_install/lib" \
    LIBDAEMON_CFLAGS="-I/home/ws/github/avahi/libdaemon_install/include" \
    LIBDAEMON_LIBS="-L/home/ws/github/avahi/libdaemon_install/lib -ldaemon"

# 编译和安装
make -j20
make install

# 源码下载地址: https://github.com/avahi/avahi/tree/v0.8

一定要设置链接器参数,否则报错:

make[1]: Entering directory '/home/ws/github/avahi/avahi/avahi-utils'
  CCLD     avahi-browse
/home/ws/chain_tools/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../aarch64-linux-gnu/bin/ld: warning: libdbus-1.so.3, needed by ../avahi-client/.libs/libavahi-client.so, not found (try using -rpath or -rpath-link)
../avahi-client/.libs/libavahi-client.so: undefined reference to `dbus_message_get_member'
../avahi-client/.libs/libavahi-client.so: undefined reference to `dbus_connection_set_timeout_functions'
../avahi-client/.libs/libavahi-client.so: undefined reference to `dbus_connection_set_exit_on_disconnect'

三、编译输出


http://www.kler.cn/a/504898.html

相关文章:

  • Java 泛型及其优势
  • 在 Webpack 中使用 预加载(Preloading) 技术可以通过动态导入(import())以及指定预加载的方式来进行优化
  • 浅谈云计算07 | 云安全机制
  • HTML拖拽功能(纯html5+JS实现)
  • 国内源快速在线安装qt5.15以上版本。(10min安装好)(图文教程)
  • 我国无人机新增实名登记110.3 万架,累计完成飞行2666万小时
  • iOS - 内存屏障的使用场景
  • 【机器学习】实战:天池工业蒸汽量项目(三)模型预测
  • 速通Docker === 介绍与安装
  • Graylog采集MySQL慢日志实战
  • 源码编译安装httpd 2.4,提供系统服务管理脚本并测试
  • jenkins docker 遇到 /var/run/docker.sock: permission denied 解决方案
  • 【JavaEE进阶】SpringMVC 响应
  • 代码随想录算法训练营第三十四天-动态规划-63. 不同路径II
  • vue运用uniapp框架开发企业微信小程序中常用的一些基础方法
  • C#,入门教程(27)——应用程序(Application)的基础知识
  • JavaScript:模版字符串
  • scons通用构建_生成方法Command
  • 向量数据库如何助力Text2SQL处理高基数类别数据
  • 更新用户密码功能
  • 解决nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf问题 --九五小庞
  • LeetCode | 解锁数组与字符串的秘密:经典题型详解与高效解法
  • 20250113面试鸭特训营第21天
  • STLG_01_12_程序设计C语言 - 联合体和枚举类型
  • 【AIGC-ChatGPT进阶提示词指令】智慧母婴:打造基于成长树的儿童发展引导系统
  • 【网络云SRE运维开发】2025第3周-每日【2025/01/14】小测-【第13章ospf路由协议】理论和实操解析