在Mac OS X 10.10 Yosemite上安装Perl CPAN Net :: LibIDN

时间:2014-10-20 11:03:39

标签: perl cpan osx-yosemite

升级到OS X 10.10后,所有CPAN Perl模块都被删除了,我遇到了安装Net :: LibIDN的问题:

sudo cpan -i Net::LibIDN
...
CPAN.pm: Building T/TH/THOR/Net-LibIDN-0.12.tar.gz
__test1.c:1:10: fatal error: 'idna.h' file not found

但我已经用自制软件安装了libidn:

locate libidn
/usr/local/Library/Formula/libidn.rb
/usr/local/lib/libidn.11.dylib
/usr/local/lib/libidn.a
/usr/local/lib/libidn.dylib
/usr/local/lib/libidn.la
/usr/local/lib/pkgconfig/libidn.pc
/usr/local/share/info/libidn-components.png
/usr/local/share/info/libidn.info

locate idna.h
/usr/local/Cellar/icu4c/52.1/include/unicode/idna.h
/usr/local/Cellar/icu4c/52.1/include/unicode/uidna.h
/usr/local/include/idna.h

如何安装此CPAN库并告诉CPAN.pm builder这个头文件在哪里?

1 个答案:

答案 0 :(得分:0)

在这种情况下,您需要手动构建此内容,如README

中所述

如果您的本地版本的GNU Libidn2安装在非标准版本中 位置,尝试以下代替“perl Build.PL”:

 perl Build.PL --extra_compiler_flags=-I/path/include --extra_linker_flags="-L/path/lib -lidn2"

如果运行时库搜索路径不包含libidn2,那么 可能必须设置LD_LIBRARY_PATH或编译绝对值 进入模块的库路径如下:

 LD_LIBRARY_PATH=/path/lib perl Build.PL --extra_compiler_flags=-I/path/include --extra_linker_flags="-L/path/lib -lidn2"

 LD_LIBRARY_PATH=/path/lib perl Build.PL --extra_compiler_flags=-I/path/include --extra_linker_flags="-L/path/lib -lidn2 -Wl,-rpath=/path/lib"

可能需要设置LD_LIBRARY_PATH rpath Devel :: CheckLib正确检测到libidn2的存在。