Linux中在x86架构下交叉编译ARM架构的tcpdump

Linux中在x86架构下交叉编译ARM架构的tcpdump

准备交叉编译工具

gcc-linaro-5.4.1-2017.01-x86_64_aarch64-linux-gnu.tar.xz

交叉编译工具百度网盘链接 提取码:kxnr

解压出来

tar xf gcc-linaro-5.4.1-2017.01-x86_64_aarch64-linux-gnu.tar.xz

添加编译器路径,这里我将交叉编译工具放置在了/opt目录下

PATH=$PATH:/opt/gcc-linaro-5.4.1-2017.01-x86_64_aarch64-linux-gnu/bin

准备两个包

  • libpcap-1.5.3.tar.gz
  • tcpdump-4.5.1.tar.gz

libpcap-1.5.3百度网盘链接 提取码:trya

tcpdump-4.5.1百度网盘链接
提取码:o8r5

解压出来

tar xf libpcap-1.5.3.tar.gz
tar xf tcpdump-4.5.1.tar.gz

编译libpcap

cd libpcap-1.5.3
mkdir build
./configure --prefix=/home/test/package/libpcap-1.5.3/build --host=arm-linux CC=aarch64-linux-gnu-gcc

构建的时候会报错

configure: error: pcap type not determined when cross-compiling; use --with-pcap=...

编辑configure文件将,注释报错相关的那三行

#if test -z "$with_pcap" && test "$cross_compiling" = yes; then
#        as_fn_error $? "pcap type not determined when cross-compiling; use --with-pcap=..." "$LINENO" 5
#fi

重新构建

./configure --prefix=/home/test/package/libpcap-1.5.3/build --host=arm-linux CC=aarch64-linux-gnu-gcc

编译

make
make install

编译tcpdump

cd ../tcpdump-4.5.1
mkdir build
./configure --prefix=/home/test/package/libpcap-1.5.3/build --host=arm-linux CC=aarch64-linux-gnu-gcc

构建的时候会报错

configure: error: cannot determine linux version when cross-compiling

编辑configure文件将,注释报错相关的那三行

#if test $ac_cv_linux_vers = unknown ; then
#       as_fn_error $? "cannot determine linux version when cross-compiling" "$LINENO" 5
#fi

重新构建

./configure --prefix=/home/test/package/tcpdump-4.5.1/build --host=arm-linux CC=aarch64-linux-gnu-gcc

编译

make
make install

此时在tcpdump-4.5.1目录下就生成tcpdump了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值