交叉编译avahi到aarch64平台

embedded/2025/1/16 6:01:27/

谢绝转载

一、背景

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

二、环境搭建过程

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

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

gcc_7.5.sh

#! /bin/shexport 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-staticmake -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.subecho "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-devsource ~/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.ppmy.cn/embedded/154318.html

相关文章

[笔记] MyBatis-Plus XML 配置详解:从基础到高级,全面提升开发效率

文章目录 一. 基础标签1. select 标签2. insert 标签3. update 标签4. delete 标签 二. 动态 SQL 标签1. if 标签2. choose-when-otherwise 标签3. where 标签4. set 标签5. trim 标签6. foreach 标签 三. 高级映射1. resultMap 标签2. sql 标签 四. 特殊功能1. bind 标签2. 特…

解决winodws server iis 下的php mkdir(): Permission denied 问题

这个问题报错原因是权限不够,解决办法如下: 1.在php安装目录下,打开配置文件php.ini 把upload_tmp_dir 前面的分号去掉。 2.给上传的文件夹添加权限 在网站的相应目录,比如目录为tmp,添加IUSR用户,并给所…

pytorch小记(六):pytorch中的clone和detach操作:克隆/复制数据 vs 共享相同数据但 与计算图断开联系

pytorch小记(六):pytorch中的clone和detach操作:克隆/复制数据 vs 共享相同数据但 与计算图断开联系 1. x.clone()示例: 2. x.detach()示例:使用场景: 3. torch.tensor(x).float()示例&#xff…

概率论考前一天

判断是不是分布函数:单调不减,右连续,F负无穷为0, F正无穷为1 判断是不是密度函数:非负性(函数任意地方都大于0),规范:积分为1

JavaScript系列(27)--安全测试与审计指南

JavaScript安全测试与审计指南 🔍 在当今的网络环境中,安全测试和审计已经成为开发过程中不可或缺的一部分。本文将深入探讨如何对JavaScript应用进行全面的安全测试和审计。 为什么需要安全测试? 🤔 💡 小贴士&…

unity——Preject3——面板基类

目录 1.Canvas Group Canvas Group 的功能 Canvas Group 的常见用途 如何使用 Canvas Group 2.代码 3.代码分析 类分析:BasePanel 功能 作用 实际应用 代码解析:hideCallBack?.Invoke(); 语法知识点 作用 虚函数(virtual)和抽象类(abstract)的作用与区别 …

MyBatis-增删改查操作一些细节

目录 删除 新增 修改 查询 小结: 删除功能 需求:根据ID删除用户信息 SQL:delete from user where id 5; Mapper接口方法(注意这里不是实现类): /*** 根据id删除*/ Delete("delete from user wher…

elementUI项目中,只弹一个【token过期提示】信息框的处理

关键代码 let msgArr document.querySelectorAll(.token401Message)if (!msgArr.length) {Message({customClass: token401Message,message: response.data.msg,type: error,onClose: () > {msgArr []}})} 完整代码 import axios from axios import { getToken } from…