2015-07-20 178 views
3

我想弄清楚爲什麼我不能讓GD Perl模塊安裝在我的Debian 7服務器上。這裏是我安裝了核心員工:Perl的GD模塊將不會安裝 -

sudo apt-get install libgd-gd2-perl 

然後運行-MCPAN安裝,我得到:

[email protected]:~# sudo perl -MCPAN -e 'install GD' 
Going to read '/root/.cpan/Metadata' 
    Database was generated on Sun, 19 Jul 2015 21:41:02 GMT 
Running install for module 'GD' 
Running make for L/LD/LDS/GD-2.56.tar.gz 
Checksum for /root/.cpan/sources/authors/id/L/LD/LDS/GD-2.56.tar.gz ok 

    CPAN.pm: Going to build L/LD/LDS/GD-2.56.tar.gz 

Configuring for libgd version 2.0.36. 
Checking for stray libgd header files...none found. 

Unknown option: installdirs 
Usage: perl Build.PL [options] 

Configure GD module. 

Options: 
    -options  "JPEG,FT,PNG,GIF,XPM,ANIMGIF" feature options, separated by commas 
    -lib_gd_path path   path to libgd 
    -lib_ft_path path   path to Freetype library 
    -lib_png_path path   path to libpng 
    -lib_jpeg_path path   path to libjpeg 
    -lib_xpm_path path   path to libxpm 
    -lib_zlib_path path   path to libpng 
    -ignore_missing_gd    Ignore missing or old libgd installations and try to compile anyway 

If no options are passed on the command line. The program will 
attempt to autoconfigure itself with the gdlib-config program (present 
in GD versions 2.0.27 or later). Otherwise it will prompt for these 
values interactively. 
Warning: No success on command[/usr/bin/perl Build.PL --installdirs site] 
    LDS/GD-2.56.tar.gz 
    /usr/bin/perl Build.PL --installdirs site -- NOT OK 
Running Build test 
    Make had some problems, won't test 
Running Build install 
    Make had some problems, won't install 
Could not read metadata file. Falling back to other methods to determine prerequisites 

我已經做了谷歌搜索的負載,但似乎沒有任何解決它。有什麼建議麼?

+2

是否安裝了潛在的libgd包? GD.pm是一個包裝。 –

+3

apt-get install libgd-gd2-perl沒有安裝Perl模塊嗎?通常,以'-perl'結尾的軟件包名稱會安裝相關的Perl模塊,因此我不希望您需要使用CPAN。 – ThisSuitIsBlackNot

+0

這與丟失的底層庫無關。另外兩個顯然錯過了錯誤信息:**未知選項:installdirs 用法:perl Build.PL [options] **。 'cpan'希望'Build.PL'將其參數傳遞給Module :: Build,但GD有一個時髦的'Build.PL'。稍微回答一下。 – ikegami

回答

5

你所得到的錯誤是

Unknown option: installdirs 
Usage: perl Build.PL [options] 

cpan預計Build.PL傳遞它的參數模塊::生成,但GD有一個時髦的Build.PL。讓我們「修復」它。

從臨時目錄執行以下命令:

wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.56.tar.gz 
    -or- 
curl -L http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.56.tar.gz >GD-2.56.tar.gz 

tar xvzf GD-2.56.tar.gz 
cd GD-2.56 
perl -i~ -pE'say "Getopt::Long::Configure(qw(pass_through));" if /GetOptions/;' Build.PL 
/usr/bin/perl Build.PL --installdirs site 
sudo ./Build.PL installdeps 
./Build.PL make 
./Build.PL test 
sudo ./Build.PL install 
+0

感謝您的回覆。我打算將你標記爲有效,因爲我重新考慮了這個問題會解決我的問題(我發現有幾篇文章說「修復」Build.PL文件 - 但從未給出任何有關如何操作的信息!) 。無論哪種方式,我認爲我必須很幸運,因爲我已經安裝了一些東西 - 因爲它現在起作用

+0

ikegami - 只是在dev服務器上嘗試了這一點(當我升級到debian 8.1時),它似乎得到掛在'perl -i〜-pE'say「Getopt :: Long :: Configure(qw(pass_through));」如果/ GetOptions /;「Build.PL',..剛剛在下一行顯示'>',因爲它正在等待更多的命令? –

+0

有什麼想法嗎?停留在這臺服務器上,直到我可以得到GD要去:( –

4

在Ubuntu的15.04,上述聰明的回答略有修改,爲了得到它來安裝GD似乎有必要。這個工作使'cpan'程序可以安裝GD,然後例如之後Image :: Resize(使用GD)。我做了

sudo -i 

在一個終端中,並'後'進入一個臨時文件夾。無論是價值還是不行,我第一次做

apt-get install libgd-dev 

然後這個,可以包含一個或多個冗餘線路,但它的工作原理:

wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.56.tar.gz 
tar xvzf GD-2.56.tar.gz 
cd GD* 
perl -i~ -pE'say "Getopt::Long::Configure(qw(pass_through));" if /GetOptions/;' Build.PL 
/usr/bin/perl Build.PL --installdirs site 
chmod 755 Build.PL 
./Build.PL installdeps 
./Build installdeps 
./Build test 
./Build install