标签:
1、打开网址:www.tcpdump.org/ 下载 libpcap-1.0.0.tar.gz (512.0KB) 软件包,通过命令 tar zxvf libpcap-1.0.0.tar.gz 解压文件,并将其放入自定义的安装目录。
2,进入解压后的libpcap文件夹中,运行
(sudo) ./configure
(sudo) make
(sudo) make install
2,运行(sudo) ./configure,可能会
Your operating system‘s lex is insufficient to compile
libpcap. flex is a lex replacement that has many advantages, including
being able to compile libpcap
安装flex包---- sudo apt-get install flex
解决之;
3,make
可能会遇到yacc包错误:
sudo apt-get install -y byacc
解决之;
4,gcc -g testpcap.c -o -lpcap testpcap
可能会出现如下错误:
error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory
打开 /etc目录下的文件 ld.so.conf ,添加两行
/usr/local/lib
/usr/lib
然后在终端下执行从新加载配置的命令: ldconfig
解决之;
5,要用root权限运行testpcap程序
标签:
原文地址:http://www.cnblogs.com/woshare/p/4796323.html