Chinaunix首页 | 论坛 | 博客
  • 博客访问: 913089
  • 博文数量: 132
  • 博客积分: 9976
  • 博客等级: 中将
  • 技术积分: 1781
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-30 20:40
文章分类

全部博文(132)

文章存档

2013年(1)

2011年(1)

2010年(15)

2009年(77)

2008年(36)

2007年(2)

我的朋友

分类: 嵌入式

2010-03-17 14:36:29

libpcap移植

======================================================================
from: http://hi.baidu.com/mqbest_come_on/blog/item/efbc06972f045e41d1135e80.html

1、下载 libpcap-1.0.0.tar.gz 和 tcpdump-4.0.0.tar.gz
2、解压 执行如下命令:tar -zxvf libpcap-1.0.0.tar.gz 和 tar -zxvf tcpdump-4.0.0.tar.gz 使他们都在一个目录
3、进入libpcap-1.0.0目录 执行命令:
./configure --build=i686 --host=arm-linux CC=/opt/buildroot_350/build_arm/staging_dir/bin/arm-linux-uclibc-gcc

如果出现错误:configure: error: pcap type not determined when cross-compiling; use --with-pcap=...和
                          configure: error: cannot determine linux version when cross-compiling
没有找到其他方法解决,所以采用暴力手段,修改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 --build=i686 --host=arm-linux CC=/opt/buildroot_350/build_arm/staging_dir/bin/arm-linux-uclibc-gcc
就会生成Makefile了!!!!!!!
4、执行make
5、生成libpcap.a库文件
6、进入tcpdump-4.0.0目录
7、执行命令:
./configure --build=i686 --host=arm-linux CC=/opt/buildroot_350/build_arm/staging_dir/bin/arm-linux-uclibc-gcc --disable-ipv6 --disable-smb
8、出现错误:configure: error: cannot determine linux version when cross-compiling
再次暴力修改configure文件,屏蔽如下代码:
#       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
9、编译生成Makefile
10、如果直接make的话会出现如下错误:error: invalid 'asm': invalid operand for code 'w'
11、修改Makefile文件:vi Makefile
将:
INCLS = -I. -I./../libpcap-1.0.0 -I/usr/include -I$(srcdir)/missing
DEFS = -DHAVE_CONFIG_H -I./../libpcap-1.0.0 -I/usr/include -I$(srcdir)/missing -D_U_="__attribute__((unused))"
改为:
INCLS = -I. -I./../libpcap-1.0.0 -I/opt/buildroot_350/build_arm/staging_dir/include -I$(srcdir)/missing
DEFS = -DHAVE_CONFIG_H -I./../libpcap-1.0.0 -I/opt/buildroot_350/build_arm/staging_dir/include -I$(srcdir)/missing -D_U_="__attribute__((unused))"
主要是将include的路径指定为我们自己的交叉编译的include库路径。
12、执行make 会出现错误:undefined reference to `ip6_print
此时可以再次来点暴力,修改源码!!!:vi print-enc.c
屏蔽如下代码://case AF_INET6:
     //ip6_print(p, length);
     //break;
13、最后再次执行make   OK了   生成tcpdump了    哈哈哈哈哈   你可以拿它到板子上面跑了.......

======================================================================
from:

[Stargate-users] Cross compiling libpcap

chirag rajyaguru
Tue, 19 Apr 2005 11:24:46 -0700
  • Previous message:
  • Next message:
  • Messages sorted by:

Hey Shariq,

Thanks for the prompt reply. I tried uname -p on my machine to find out what processor I have. But it says unknown. So is there another command I can use ?

Thx
Chirag

Chirag Rajyaguru
"An obstacle is something you see when you take your eyes off the goal"
MS in Computer Science
Univ. of Southern California,
Los Angeles, California.
Ph (M) : 1 323 893 4783.

Email : ,

----- Original Message -----
From: Shariq Rizvi <>
Date: Tuesday, April 19, 2005 0:24 am
Subject: Re: [Stargate-users] Cross compiling libpcap

> Hi Chirag,
>
> It seems that configure is unable to detect the build platform type
> automatically. You may want to specify it manually (for e.g.
> "--build=i686-linux")
>
> Shariq
>
> chirag rajyaguru wrote:
>
> |Hey all,
> |
> |I am a new user to the stargate platform. I know the fact that I
> have to use a crosscompiler for compiling programs to be run on
> stargate. I have installed arm-linux-gcc version 3.3.2. I want to
> use libpcap on stargate. I tried the following command with
> configure for libpcap
> |
> | ./configure --host arm-linux --prefix=/usr/local/arm-linux/
> |
> |But I get the following error.
> |
> |checking Linux kernel version... unknown
> |configure: error: cannot determine linux version when cross-compiling
> |
> |I have verified and yes it does use arm-linux-gcc for compiling.
> |
> |Any help on this issue is appreciated.
> |
> |Thanks in advance,
> |
> |Chirag
> |
> |Chirag Rajyaguru
> |"An obstacle is something you see when you take your eyes off the
> goal"|MS in Computer Science
> |Univ. of Southern California,
> |Los Angeles, California.
> |Ph (M) : 1 323 893 4783.
> |
> |Email : ,
> |
> |_______________________________________________
> |Stargate-users mailing list
> |
> |
> |
> _______________________________________________
> Stargate-users mailing list
>
>
>



  • Previous message:
  • Next message:
  • Messages sorted by:


阅读(3648) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~