在OSX上安装Perl Math :: GMP

时间:2015-11-15 07:01:06

标签: macos perl gmp osx-elcapitan

我正在尝试在OS X El Capitan上安装Perl包Math :: GMP。

我有一台计算机没有问题 - 但是第二台计算机遇到了以下问题:

Perl模块Math :: GMP需要GMP的C库,所以我做了brew install gmp

此安装的GMP包括以下文件:

/usr/local/include/gmp.h

但是软件包安装仍然无法声称我没有安装gmp:

$ sudo perl -MCPAN -e shell
cpan[1]> install Math::GMP
Reading '/Users/chaosadmin/.cpan/Metadata'
Database was generated on Sat, 14 Nov 2015 09:17:02 GMT
Running install for module 'Math::GMP'
Checksum for /Users/me/.cpan/sources/authors/id/S/SH/SHLOMIF/Math-GMP-2.11.tar.gz ok
Scanning cache /Users/me/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring S/SH/SHLOMIF/Math-GMP-2.11.tar.gz with Makefile.PL
Can't link/include C library 'gmp.h', 'gmp', aborting.
No 'Makefile' created  SHLOMIF/Math-GMP-2.11.tar.gz
  /usr/bin/perl Makefile.PL -- NOT OK
Failed during this command:
 SHLOMIF/Math-GMP-2.11.tar.gz                 : writemakefile NO -- No 'Makefile' created

显而易见的是: Can't link/include C library 'gmp.h', 'gmp', aborting.

但我绝对在/usr/local/include/gmp.h安装了“gmp.h” 我不确定为什么它无法在这台OS X El Capitan机器上安装(它在我的另一台机器上工作正常)。

在我使用的CPAN shell中:

look Math::GMP

并更新了Makefile.PL以进行调试:

check_lib_or_exit(
    header => 'gmp.h',
    lib => 'gmp',
    debug => 'true'
);

运行perl Makefile.PL

时显示以下错误
# /usr/bin/cc -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -arch i386 -arch x86_64 -fstack-protector assertlibD4RJzZEa.c -o assertlibwGFzIVsM
assertlibD4RJzZEa.c:1:10: fatal error: 'gmp.h' file not found

包括

1 个答案:

答案 0 :(得分:-1)

On Centos:

只需安装:yum install gmp * -y

祝你好运:)