最近,我试图通过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。 有谁知道如何解决这个问题?感谢
答案 0 :(得分:4)
README的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可能会更容易。
答案 1 :(得分:2)
这解决了我的问题:
yum -y install perl-Net-Pcap libpcap-devel