制定交叉编译工具_交叉编译的一般方法 | 学步园

I'm trying to cross-compile NetSNMP 5.4.2 for running on an embedded system(mips).

由于我使用的CPU是little endian 交叉编译工具是 mipsel-linux

如果你用的是Big endian,交叉编译用具就可能是 mips-linux

1. 设置环境变量::

TOOLCHAIN=mipsel-linux-

CC=${TOOLCHAIN}gcc

CPP=${TOOLCHAIN}cpp

AR=${TOOLCHAIN}ar

STRIP=${TOOLCHAIN}strip

RANLIB=${TOOLCHAIN}ranlib

LD=${TOOLCHAIN}ld

2. 编译安装::

../net-snmp-5.4.2.1/configure --build=i686-linux --host=mipsel-linux --target=mipsel-linux --with-transports="UDP"  --prefix=/opt/rootfs/snmp --with-endianness=little --with-persistent-directory=/var/net-snmp/ --with-default-snmp-version="2" --enable-mini-agent --without-kmem-usage --disable-debugging --disable-embedded-perl --without-perl-modules

make

make install

PS:

1. 如果你采用的是 Big endian, --with-endianness=little 应该改为 --with-endianness=big

2. 如果不想对openssl 的支持,用 --without-openssl

3. 测试::

border@ubuntu:/opt/rootfs/snmp/sbin$ pwd

/opt/rootfs/snmp/sbin

border@ubuntu:/opt/rootfs/snmp/sbin$ file snmpd

snmpd: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

border@ubuntu:/opt/rootfs/snmp/sbin$ file snmptrapd

snmptrapd: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值