Ubuntu: can't install cpan module GD


Since I failed to install Image::Magick on my non-GUI Ubuntu server Ubuntu 14.04.2 LTS (read about it here), I tried to install another image-manupulation tool that can be used from a perl-script: GD. But I also failed to install it:

~# cpan install GD  Reading '/root/.cpan/Metadata'    Database was generated on Thu, 21 May 2015 22:17:02 GMT  Running install for module 'GD'  Checksum for /root/.cpan/sources/authors/id/L/LD/LDS/GD-2.56.tar.gz ok  Configuring L/LD/LDS/GD-2.56.tar.gz with Build.PL  Configuring for libgd version 2.1.1-dev@.  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  

I think the problem starts with Checking for stray libgd header files...none found., but I have no idea what i did wrong, or what I could do to make it better.

Please help!!

supplement (2015-09-02)

I've got the hint to install libgd-gd2-perl (See answer from chicks):

apt-get install libgd-gd2-perl  

I followed this instruction (as root), but it did change nothing at all. When I executed cpan install GD I've got exactly the same messages as listed above.

supplement (2015-09-28)

Another hint was to install libgd-perl:

apt-get install libgd-perl  

When I did, the previous installed package libgd-gd2-perl was automatically removed. After the installation has finished, I tried to install GD with the command

cpan install GD    

And at the end I did get exactly the same error message as in May and as three weeks ago:

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  


It's a known and open bug, read here, and I can reproduce this error.

I have copied the following from here, all credits go to @Schwern.

Build.PL is trying to call a function called prompt but it doesn't exist. This is because they recently switched build systems from ExtUtils::MakeMaker (Makefile.PL) to Module::Build (Build.PL) but didn't fully convert the program. I've reported the bug.

Most people don't notice this because the prompting is only necessary if GD can't configure itself. It does this by looking for the gdlib-config program. If that can't be found, or it doesn't work, it will ask you for your gdlib configuration. It's best to let gdlib-config take care of that. Best way to solve this problem is to make sure gdlib-config is somewhere in your PATH and that gdlib-config --all works.

Otherwise replace all the instances of prompt with Module::Build->prompt and it should work.

And here is the problematic code in Build.pl

my $PREFIX = $lib_gd_path;  if( ! defined($lib_gd_path) )  {    warn "\n";    $PREFIX = prompt('Where is libgd installed?','/usr/lib');  }  

and here

my ($JPEG, $FT, $XPM, $GIF,$ANIMGIF,$UNCLOSEDPOLY,$FONTCONFIG,$PNG,$FTCIRCLE,$VERSION_33);  if( defined($options) )  {    $JPEG      = $options =~ m/JPEG/i;    $FT        = $options =~ m/FT|FREETYPE/i;    $XPM       = $options =~ m/XPM/i;    $GIF       = $options =~ m/GIF/i;    $PNG       = $options =~ m/PNG/i;    $ANIMGIF   = $GIF && $options =~ m/ANIMGIF/i;    $VERSION_33= $options =~ m/VERSION_33/i;    $UNCLOSEDPOLY  = $options =~ m/UNCLOSEDPOLY/i;    $FONTCONFIG  = $options =~ m/FONTCONFIG/i;    $FTCIRCLE  = $options =~ m/FTCIRCLE/i;  }  else  {      warn "\nPlease choose the features that match how libgd was built:\n";      $JPEG    = lc prompt('Build JPEG support?','y') eq 'y';      $PNG     = lc prompt('Build PNG support?','y') eq 'y';      $FT      = lc prompt('Build FreeType support?','y') eq 'y';      $GIF     = lc prompt('Build GIF support?','y') eq 'y';      $ANIMGIF = $GIF && lc prompt('Build support for animated GIFs?','y') eq 'y';      $XPM     = $^O !~ /^freebsd|MSWin32$/ && lc prompt('Build XPM support?','y') eq 'y';  }  

and so on.



sudo apt-get install libgd-gd2-perl  

to install the package which will take care of the dependancies you are missing.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »