您的位置:首页 > 运维架构 > Linux

libpcap1.0.0移植到arm开发板上

2011-09-20 19:38 661 查看
在移植的过程中,主要参考了这篇博文http://blog.sina.com.cn/s/blog_4bec945b010009r2.html

1、从http://www.tcpdump.org/官方网址上下载libpcap1.0.0源码压缩包,进行解压。

2、修改confiugre文件,把下面两段注释掉,在6249行和6587行,为什么要这样做,没有深入了解其原因。

#if test -z "$with_pcap" && test "$cross_compiling" = yes; then

 # { { echo "$as_me:$LINENO: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&5

 #echo "$as_me: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&2;}

 #   { (exit 1); exit 1; }; }

 #fi

  .......

 #  if test $ac_cv_linux_vers = unknown ; then

 #   { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5

 #echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}

 #   { (exit 1); exit 1; }; }

 #  fi

3、 执行./configure --host=arm-linux,这样就会使用arm-linux-gcc进行configure,生成Makefile

4、修改Makefile的prefix项为prefix=/usr/local/arm/3.4.1/arm-linux(这个就是你的交叉编译器所在目录,根据自己的情况修改),同时查看CC是否已=arm-linux-gcc。

5、接下来make,make install,完成了libpcap的编译和安装,查看/usr/local/arm/3.4.1/arm-linux/include,是否多出pcap文件夹和pcap.h、pcap-bpf.h、pcap-namedb.h这四个东西。

到此libpcap1.0.0移植成功,接下来就是自己编写相关应用程序进行测试了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息