问题描述
最近,我尝试通过cpan安装perl模块Net :: Packet和Net :: Pcap,但它抱怨找不到pcap库。所以我正在搜索cpan在安装模块时是否会接受外部lib / include目录,但是直到现在还没有运气。
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.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
我的pcap库位于/ opt / local / lib,标头位于/ opt / local / include / pcap。
有人知道如何解决此问题吗?谢谢
my pcap library is located at /opt/local/lib and header at /opt/local/include/pcap.Anyone know how to solve this issue? Thanks
推荐答案
文件,用于显示了如何告诉Makefile.PL在哪里找到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将路径插入到示例中。)
(I've inserted your paths into the example.)
但是,获取外壳要复杂得多。您必须使用系统并创建一个YAML文件来提供论据。如果您还不熟悉Distroprefs,那么手动安装Net :: Pcap可能会更容易。
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.
这篇关于由于lpcap,CPAN安装Net :: Pcap和Packet模块失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!