libpcap交叉编译

5259阅读 0评论2009-06-27 ywh_hlp
分类:LINUX

1、解压libpcap-0.9.8.tar.gz,进入目录,修改confiugre文件,把下面两段注释掉
#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
 
2、./configure --host=arm-9tdmi-linux-gnu生成Makefile
3、修改Makefile中prefix=$CROSS_COMPILE_PWD
4、接下来make,make install,完成了libpcap的编译和安装
5、接着就可以编写你的抓包程序了。记得在用arm-9tdmi-linux-gnu-gcc编译时加上“-lpcap”选项。
 
注意:第一次编译的时候不知道哪一步出了问题,最后编译程序的时候总是提示出错:undefined reference to `pcap_parse',最后将arm-linux-gcc和libpcap全部重新装了一次就好了。现在可以在YC2440开发板上抓包了,呵呵,算是达到第一个小目标吧。只是utu-linux上的中文显示为乱码的问题还没有解决,再接再厉吧!
上一篇:Linux下NFS的配置与注意的问题
下一篇:中级嵌入式软件工程师 招聘需要什么必备技能