libnet的移植遇到的不少问题,查询了许多文档都无法成功,倒腾了一整天最终移植成功了,小小的开心一下,嘿嘿。
步骤:
1.解压libnet。
2.进入文件夹,先执行./configure –host=arm-linux
再打开configure,将prefix修改为编译器arm-linux-gcc的安装地址
3.再make,出现如下错误:
../include/libnet.h:117:10: macro names must be identifiers(说明../include/libnet.h第117行有问题)
于是打开libnet.h,将117行#define 1注释掉
4.再make,出现如下错误:
libnet_build_ip.c: In function `libnet_build_ipv4′:
libnet_build_ip.c:80: error: structure has no member named `ip_v’
libnet_build_ip.c:81: error: structure has no member named `ip_hl’
libnet_build_ip.c:96: error: structure has no member named `ip_hl’
libnet_build_ip.c: In function `libnet_autobuild_ipv4′:
libnet_build_ip.c:282: error: structure has no member named `ip_v’
libnet_build_ip.c:283: error: structure has no member named `ip_hl’
libnet_build_ip.c:298: error: structure has no member named `ip_hl’
libnet_build_ip.c: In function `libnet_build_ipv4_options’:
libnet_build_ip.c:435: error: structure has no member named `ip_hl’
make[1]: *** [libnet_build_ip.o] Error 1
make[1]: Leaving directory `/root/libnet/src’
make: *** [all-recursive] Error 1
于是打开include/libnet/libnet-headers.h,添加一行:#define LIBNET_LIL_ENDIAN 1
5.再make,通过了,嘿嘿。