移植pcap库到ARM开发板

    首先到http://www.tcpdump.org/上下载libpcap-0.9.4源代码 ,解压后进入目录,一下为具体的执行过程:
       
    [root@olive libpcap-0.9.4]# ./configure --host=arm-linux
    configure: error: pcap type not determined when cross-compiling; use --with-pcap=...
       
    运行configure说交叉编译时没指定pcap类型,看了README文档,试了指定了几种类型,但configure时均出错!没办法了,只好采取暴力措施了,在configure脚本中注释掉检查交叉编译的部分,具体注释掉一下语句:
    
 #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
 
    再次运行configure命令,这下终于OK!终于生成了Makefile.接下来make:
    
    [root@olive libpcap-0.9.4]#make 
    
    居然没生成动态链接库,只有一个libpcap.a静态库.只好再修改它的Makefile.打开Makefile,找到了下面这个目标:
 
 libpcap.so: $(OBJ)
  @rm -f $@
  ld -shared -o $@.`cat VERSION` $(OBJ)
    把链接器ld该成arm-linux-ld,然后make此目标:
         
    [root@olive libpcap-0.9.4]# make libpcap.so
        
    这样便生成了动态库libpcap.so.0.9.4,可样就可以将此拷贝到Liod板的/lib/这个目录下,别忘了在再创建两个符号链接:
libpcap.so.0和libpcap.so.
       
    此时便可以利用pcapTest这个小程序来测试一下了.测试OK,可以捕获网络数据包,终于大功告成!
                                                                                                   
                                                                                                                                        06.5.19 
                                                                                                                                         21:00

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值