2015-07-20 184 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