2012-05-04 128 views
6

我試圖安裝Math::GMP,但它一直在失敗,我不知道該從哪裏出發。這是林打字和這裏輸出指向日誌文件:Math ::安裝時出現的GMP錯誤

[[email protected] Math-GMP-2.06-VEVNp7]# cpanm Math::GMP 
--> Working on Math::GMP 
Fetching http://www.cpan.org/authors/id/T/TU/TURNSTEP/Math-GMP-2.06.tar.gz ... OK 
Configuring Math-GMP-2.06 ... OK 
Building and testing Math-GMP-2.06 ... FAIL 
! Installing Math::GMP failed. See /root/.cpanm/build.log for details. 
[[email protected] Math-GMP-2.06-VEVNp7]# 

我查了日誌和IM不知道什麼結構IM應該有 這裏是/root/.cpanm/build.log

cpanm (App::cpanminus) 1.5011 on perl 5.008008 built for i386-linux-thread-multi 
Work directory is /root/.cpanm/work/1336128898.6464 
You have make /usr/bin/make 
You have /usr/bin/wget 
You have /bin/tar: tar (GNU tar) 1.15.1 
You have /usr/bin/unzip 
Searching Math::GMP on cpanmetadb ... 
--> Working on Math::GMP 
Fetching http://www.cpan.org/authors/id/T/TU/TURNSTEP/Math-GMP-2.06.tar.gz 
-> OK 
Unpacking Math-GMP-2.06.tar.gz 
Entering Math-GMP-2.06 
Checking configure dependencies from META.yml 
Configuring Math-GMP-2.06 
Running Makefile.PL 
Checking if your kit is complete... 
Looks good 
Writing Makefile for Math::GMP 
-> OK 
Finding PREREQ from Makefile ... 
Building and testing Math-GMP-2.06 
cp lib/Math/GMP.pm blib/lib/Math/GMP.pm 
AutoSplitting blib/lib/Math/GMP.pm (blib/lib/auto/Math/GMP) 
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -  typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap GMP.xs > GMP.xsc && mv GMP.xsc GMP.c 
gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/inc$ 
GMP.xs:4:17: error: gmp.h: No such file or directory 
GMP.xs: In function âconstantâ: 
GMP.xs:49: warning: label ânot_thereâ defined but not used 
GMP.c: In function âXS_Math__GMP_new_from_scalarâ: 
GMP.c:93: error: âmpz_tâ undeclared (first use in this function) 
GMP.c:93: error: (Each undeclared identifier is reported only once 
GMP.c:93: error: for each function it appears in.) 
GMP.c:93: error: âRETVALâ undeclared (first use in this function) 
GMP.xs:70: warning: implicit declaration of function âmpz_init_set_strâ 
GMP.c: In function âXS_Math__GMP_new_from_scalar_with_baseâ: 
GMP.c:114: error: âmpz_tâ undeclared (first use in this function) 
GMP.c:114: error: âRETVALâ undeclared (first use in this function) 
GMP.c: In function âXS_Math__GMP_destroyâ: 
GMP.c:133: error: âmpz_tâ undeclared (first use in this function) 

回答

12
日誌

GMP.xs:4:17: error: gmp.h: No such file or directory

是重要組成部分。

您必須安裝libgmp的開發文件/頭文件。在我的openSUSE系統上,相關文件是/usr/include/gmp.h,該軟件包名爲gmp-devel。在Debian /衍生系統上,該軟件包被稱爲libgmp3-dev

+3

如果該提議[非CPAN依賴易於安裝](http://news.perlfoundation.org/2012/05/2012q2-grant-proposal-easy-ins .html)被[chorny](http://stackoverflow.com/users/13467/alexandr-ciornii)授予並完成,這些初學者問題將大大減少。社區,請分享這個。 – daxim

+0

謝謝@daxim。安裝gmp-devel的確有竅門。 :) – Technext

2

在我的Ubuntu盒子上,我安裝了新立得軟件包管理器的libmath-gmp-perl。有關GMP包將被編譯。儘管這不是一個好的解決方法,但它對我很有用。

0

運行下面的命令:

yum install gmp-static