Mac上基于ARM的Linux系统的交叉编译源代码问题

时间:2014-10-16 02:09:24

标签: linux macos

port install arm-none-eabi-gcc
port install arm-none-eabi-binutils

我在我的Mac上下载了手臂工具。

export CCPREFIX=/opt/local/bin/arm-none-eabi-
make ARCH=arm CROSS_COMPILE=${CCPREFIX}

however it has alot of errors.
tcpdump.c:180: error: ‘struct tcphdr’ has no member named ‘source’
tcpdump.c:238: error: ‘ETH_P_ARP’ undeclared (first use in this function)
tcpdump.c:238: error: ‘ETH_P_ARP’ undeclared (first use in this function)
tcpdump.c:116: error: dereferencing pointer to incomplete type
tcpdump.c:136: error: invalid application of ‘sizeof’ to incomplete type ‘struct icmphdr’ 
tcpdump.c:136: error: invalid application of ‘sizeof’ to incomplete type ‘struct iphdr’ 

貌似mac不知道那些Linux定义,结构,

如果在Linux系统中生成相同的代码,那就OK了。

问题是,使用Mac交叉编译基于ARM的Linux系统的代码是否可行?

1 个答案:

答案 0 :(得分:0)

您使用的是错误的工具链。 arm-none-eabi适用于裸机ARM系统 - 即没有操作系统的ARM系统,如微控制器 - 而不是Linux系统。这些系统没有网络堆栈(除非您自己编译),因此它们没有TCP / IP数据结构的标头。

我不认为MacPorts有适当的工具链,但您可以使用crosstool-ng构建一个。包含在crosstool中的arm-unknown-linux-gnueabi样本可能就是您正在寻找的。