Chinaunix首页 | 论坛 | 博客
  • 博客访问: 120495
  • 博文数量: 25
  • 博客积分: 1465
  • 博客等级: 上尉
  • 技术积分: 270
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-26 17:06
文章分类

全部博文(25)

文章存档

2011年(2)

2010年(8)

2009年(15)

我的朋友

分类: LINUX

2009-11-29 03:20:35

下面介绍一下具体过程。

1.下载libpcap-0.9.8.tar.gztcpdump-3.9.8.tar.gz两个文件。

2解压。

3.编译,安装libpcap-1.0.0

   1)进入libpcap目录,打开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 --host=arm-linu

   2)配置之后,会生成Makefile。打开Makefile发现CC=arm-uclibc-linux-gcc,说明交叉编译配置成功。

  prefix项为prefix=/usr/local/arm/3.4.1/arm-linux。然后makemake install

   发现/usr/local/arm/3.4.1/arm-uclibc-linux/include有了3pcap文件,libpcap编译安装成功。

  

3.编译,安装tcpdump-3.9.8

   1)进入tcpdump目录,打开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

     运行./configure --host=arm-linux

   2)打开生成的Makefile,将INCLS项改为INCLS=-I.-I./../libpcap-1.0.0 -I$(srcdir)/missing -I/usr/local/include,

       DEFS项改为DEFS=-DHAVE_CONFIG_H -I./../libpcap-1.0.0 -I/usr/local/include -I$(srcdir)missing -D_U_="__attribute__((unused))"

       LDFLAGS=-L/usr/local/lib

然后makemake install。在/usr/local/sbin下有个tcpdump的二进制文件,这个就是交叉编译成功的tcpdump

   3)将这个二进制文件下载到arm板上,chmod 777 tcpdump将其变为可执行文件。

   4)运行tcpdump,成功!

你可能需要解决一些依赖关系,比如flexm4bison

 

 

 

2.5.35.tar.gz

 

安装顺序:

 

m4flexbisonlibpcaptcpdump

 

编译tcpdump的时候,报了一个错误

 

undefined reference to `ip6_print'

 

然后我尝试使用./configure --disable-ipv6 来消除这个错误,可是不管用。

 

没办法,只好去源代码里看看了。是print-enc.c 这个文件,打开后找到了这么一段:

 

       case AF_INET6:

       ip6_print(p, length);

       break;

 

我直接把ip6_print(p, length);这行给注释

 

然后make && make install,一切正常。然后make && make install,一切正常。

 

 

 

 

Make error ----pcap

gcc *.o -o find_stats -lpcap
/usr/local/lib/libpcap.a(gencode.o): In function `.L149':
gencode.c:(.text+0x7b4): undefined reference to `pcap_parse'
collect2: ld returned 1 exit status
make: *** [find_stats] Error 1


solution:

文件: source.rar
大小: 1424KB
下载: 下载


sudo apt-get install libpcap-dev
sudo apt-get install libnids-dev
sudo apt-get install libnet1-dev

 

 

 

阅读(2301) | 评论(0) | 转发(0) |
0

上一篇:工具

下一篇:续上篇

给主人留下些什么吧!~~