由于 lpcap,CPAN 安装 Net::Pcap 和 Packet 模块失败

发布于 2024-12-05 14:04:14 字数 799 浏览 1 评论 0原文

最近,我尝试通过 cpan 安装 perl 模块 Net::Packet 和 Net::Pcap 但它抱怨找不到 pcap 库。所以我正在搜索 cpan 在安装模块时是否接受外部 lib/include 目录,但到目前为止还没有运气。

looking for -lpcap... no
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You appear to lack the pcap(3) library. 

If it is installed in a non-standard locatio n, please try setting the LIBS 
and INC values on the command line.

Or get the sources and install the pcap library from http://www.tcpdump.org/

If you install the pcap library using a system package, make sure to also 
install the corresponding -devel package, which contains the C headers needed 
to compile this module. 
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

我的 pcap 库位于 /opt/local/lib ,标头位于 /opt/local/include/pcap。 有人知道如何解决这个问题吗?谢谢

Recently, I tried to install perl module Net::Packet and Net::Pcap through cpan but it complained that it cannot find pcap library. So I was searching if cpan would accept external lib/include directory when installing module, but no luck til now.

looking for -lpcap... no
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You appear to lack the pcap(3) library. 

If it is installed in a non-standard locatio n, please try setting the LIBS 
and INC values on the command line.

Or get the sources and install the pcap library from http://www.tcpdump.org/

If you install the pcap library using a system package, make sure to also 
install the corresponding -devel package, which contains the C headers needed 
to compile this module. 
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

my pcap library is located at /opt/local/lib and header at /opt/local/include/pcap.
Anyone know how to solve this issue? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

谁的新欢旧爱 2024-12-12 14:04:14

README 文件。 org/perldoc?Net%3a%3aPcap" rel="nofollow">Net::Pcap 显示了如何告诉 Makefile.PL 在哪里可以找到 pcap 库:(

perl Makefile.PL INC=-I/opt/local/include/pcap LIBS='-L/opt/local/lib -lpcap'

我已将您的路径插入到示例中。)

然而,得到 cpan shell 将这些参数传递给 Makefile.PL 相当复杂。您必须使用 Distroprefs 系统并创建一个 YAML 文件来提供论据。如果您还不熟悉 Distroprefs,那么手动安装 Net::Pcap 可能会更容易。

The README file for Net::Pcap shows how to tell Makefile.PL where to find the pcap library:

perl Makefile.PL INC=-I/opt/local/include/pcap LIBS='-L/opt/local/lib -lpcap'

(I've inserted your paths into the example.)

However, getting the cpan shell to pass those arguments to Makefile.PL is rather more complicated. You'd have to use the Distroprefs system and create a YAML file to supply the arguments. If you're not already familiar with Distroprefs, it'll probably be easier to just install Net::Pcap by hand.

智商已欠费 2024-12-12 14:04:14

这解决了我的问题:

yum -y install perl-Net-Pcap libpcap-devel

This fixed my issue:

yum -y install perl-Net-Pcap libpcap-devel
傲鸠 2024-12-12 14:04:14

在 Ubuntu 上,只需安装 libnet-pcap-perl。

On Ubuntu, just install libnet-pcap-perl.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文