3

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
Hubert Schölnast
  • 193
  • 1
  • 2
  • 12

2 Answers2

2

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.

A.B.
  • 89,123
  • 21
  • 245
  • 323
  • I can call `gdlib-config --all` and I get an output that doesn't look like an error. I interpret this as: 1. `gdlib-config` is somewhere in my path; 2. `gdlib-config --all` works. But still `cpan install GD` returns "NOT OK" and then quits. – Hubert Schölnast Sep 28 '15 at 11:38
  • I have also no errors wit `gdlib-config --all` and `cpan install GD` fails. The problem is: `Build.PL is using prompt() as a function, MakeMaker style. In Module::Build, prompt is a class or object method. See Module::Build::API. ` – A.B. Sep 28 '15 at 11:41
  • So you want me to search for the perl-script Build.pl and to edit it? You mean I should replace every call of `prompt(` by `Module::Build->prompt(`? Did I understand you correct? – Hubert Schölnast Sep 28 '15 at 11:50
  • Yes, that's what I meant. – A.B. Sep 28 '15 at 11:50
  • `find / -name "Build.pl"` returns nothing. Looks like there is no Build.pl on my computer. **EDIT:** But there 8 versions of `Built.PL` (with uppercase PL) – Hubert Schölnast Sep 28 '15 at 11:53
  • I think the problem is, that `cpan install GD` wants to call the module `Build.PL` from the directory `/usr/bin/perl`. But non of my 8 versions of Build.PL is there. They are in 8 different subdirectories of `/root/.cpan/build/` and none of them is executable. – Hubert Schölnast Sep 28 '15 at 12:12
  • I have not one of this folders and `Build.PL` isn't executable, it's called via `perl Build.PL` – A.B. Sep 28 '15 at 12:16
  • I called `perl Build.PL`, this created - without prompting me - a new script `Build`. I then called `perl Build`, and now GD seems to be installed. I can use GD within my own perl-scripts now. – Hubert Schölnast Sep 28 '15 at 12:33
  • The `Build.PL` in question is not a program installed on your computer, it's part of the GD.pm source tree. It's Perl's equivalent to `Configure`. It doesn't have to be executable. It'll be something like `.cpan/build/GD-2.56/Build.PL`. – Schwern Sep 28 '15 at 19:08
-1

Try:

sudo apt-get install libgd-gd2-perl

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

chicks
  • 572
  • 8
  • 24
  • Sorry, no. I installed libgd-gd2-perl, but it did change nothing. `cpan install GD` brings exactly the same error as before. – Hubert Schölnast Sep 01 '15 at 21:20
  • Is your `PERLLIB` not in the default place? You shouldn't have to install the module after installing the package. – chicks Sep 27 '15 at 21:08
  • you might need package `libgd-perl` instead. – chicks Sep 27 '15 at 21:08
  • This did not help. When I installed `libgd-perl` the previous installed package `libgd-gd2-perl` was removed. After this installation finished, I entered `cpan install GD` and at the end I've got exactly the same error-message that I posted in my question ("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") – Hubert Schölnast Sep 28 '15 at 09:40
  • You don't need to install it with CPAN once you install it as a package. Have you tried using the module after installing either of the packages? – chicks Sep 28 '15 at 13:18