j3 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to install GD::Graph (hence, also GD) on a GNU/Linux server for which I have no root access. It's got Perl 5.8.0. Building GD is failing, and I'm hoping someone can help.

I created a fresh new empty ~/perllib directory to house my local Perl modules.

I checked, and the system seems to have the necessary C libs: libgd, libpng, zlib. Looks like I only need GD and GD::Text.

I checked to see if GD was present: perl -MGD -e 1. No dice. GD::Text not installed either.

Downloaded GD-2.35.tar.gz. Tried perl Makefile.PL (forgetting to use PREFIX=... at the moment). Got this strange (redundant-looking) error:

** WARNING: found gd.h header file in /usr/include/gd.h, but it is exp +ected at /usr/include/gd.h. This may cause compile errors! ** ** Possible problems found ** GD library used from: /usr

It asked me a few questions, then made the makefile. Though, a warning while building the makefile said that I needed Math::Trig.

Installed Math::Trig (Math-Complex-1.36.tar.gz): perl Makefile.PL PREFIX=~/perllib/, make, make test, make install. Looks like it installed properly.

Back to GD. I still get this: Warning: prerequisite Math::Trig 0 not found.

Smacked myself in the forehead and set PERL5LIB: export PERL5LIB=~/perllib. Tried again. Still no joy. (Weird... why can't it find Trig.pm? I can see it right there in ~/perllib/lib/perl5/site_perl/5.8.0/Math.)

Then noticed that ~/perllib actually contained its own lib subdirectory. Am I supposed to set PERL5LIB=~/perllib/lib? Or just ~/perllib? Anyhow, tried both, and neither worked. It seems that GD's Makefile.PL can't find it either way.

Finally, not sure if it's related, but if I try to run make for GD anyway, I get this error:

$ make cc -c -I/usr/include -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE +_OFFSET_BITS=64 -O3 -DVERSION=\"2.35\" -DXS_VERSION=\"2.35\" -fPIC +"-I/usr/lib/perl5/5.8.0/i386-linux/CORE" -DHAVE_JPEG -DHAVE_FT -DHAV +E_XPM -DHAVE_GIF -DHAVE_PNG -DHAVE_ANIMGIF GD.c GD.xs: In function `XS_GD__Image__newFromGif': GD.xs:855: warning: assignment makes pointer from integer without a ca +st GD.xs: In function `XS_GD__Image_STORABLE_thaw': GD.xs:922: warning: assignment makes pointer from integer without a ca +st GD.xs: In function `XS_GD__Image_stringFT': GD.xs:2184: structure has no member named `charmap' GD.xs:2190: `gdFTEX_CHARMAP' undeclared (first use in this function) GD.xs:2190: (Each undeclared identifier is reported only once GD.xs:2190: for each function it appears in.) GD.xs:2192: structure has no member named `charmap' GD.xs:2192: `gdFTEX_Unicode' undeclared (first use in this function) GD.xs:2194: structure has no member named `charmap' GD.xs:2194: `gdFTEX_Shift_JIS' undeclared (first use in this function) GD.xs:2196: structure has no member named `charmap' GD.xs:2196: `gdFTEX_Big5' undeclared (first use in this function) GD.xs: In function `XS_GD__Font_DESTROY': GD.xs:2437: warning: comparison between pointer and integer GD.xs:2438: warning: comparison between pointer and integer GD.xs:2439: warning: comparison between pointer and integer GD.xs:2440: warning: comparison between pointer and integer GD.xs:2441: warning: comparison between pointer and integer GD.xs: In function `XS_GD__Font_Small': GD.xs:2453: warning: assignment makes pointer from integer without a c +ast GD.xs: In function `XS_GD__Font_Large': GD.xs:2464: warning: assignment makes pointer from integer without a c +ast GD.xs: In function `XS_GD__Font_Giant': GD.xs:2475: warning: assignment makes pointer from integer without a c +ast GD.xs: In function `XS_GD__Font_MediumBold': GD.xs:2486: warning: assignment makes pointer from integer without a c +ast GD.xs: In function `XS_GD__Font_Tiny': GD.xs:2497: warning: assignment makes pointer from integer without a c +ast make: *** [GD.o] Error 1

I've tried telling GD's Makefile.PL that I don't need various features it asks me about (it inquires whether your version of libgd was compiled with support for jpeg, png, freetype, gif, animated gif, and xpm), but I still seem to get the same errors.

Replies are listed 'Best First'.
Re: help installing GD and GD::Graph locally
by syphilis (Archbishop) on Nov 10, 2006 at 00:11 UTC
    Though, a warning while building the makefile said that I needed Math::Trig

    Math::Trig is core perl on 5.8, so it's likely that you already had it. From the GD-2.35 Makefile.PL:
    If you are using Math::Trig 1.01 or lower, it has a bug that causes a "prerequisite not found" warning to be issued. You may safel +y ignore this warning.
    GD.xs:2184: structure has no member named `charmap'

    According to my gd.h the gdFTStringExtra struct does have a member named 'charmap'. Looks like there is a problem with the 'gd.h' file that is being found. Perhaps it's just that your version of the GD C library is too old. (The Makefile.PL specified at least 2.0.28. What version do you have ?)

    GD.xs:2190: `gdFTEX_CHARMAP' undeclared (first use in this function)

    According to my 'gd.h':
    #define gdFTEX_CHARMAP 2

    So there is something definitely amiss with the rendition of 'gd.h' that is being found.

    Cheers,
    Rob

      Ugh. Sorry to waste everyone's time. Looks like I probably need a newer version of libgd installed.

      Will try to get a newer version of libgd (the C library) built and installed in my own ~/opt and then try building/installing GD again.

      Thanks for investigating, Rob.

      In the meantime, regarding installing your own modules into your own local ~/perllib directory: is it supposed to be

      perl Makefile.PL PREFIX=/home/me/perllib # or perl Makefile.PL LIB=/home/me/perllib # ?

      In perlmodinstall it says to use PREFIX, but the Camel book (in the CPAN chapter) mentions LIB, INSTALLMAN1DIR, INSTALLMAN3DIR, INSTALLBIN, and INSTALLSCRIPT. In the Cookbook, in item 12.21, I believe it says to use LIB, and that PREFIX is for when you've got your own Perl installed somewhere in /home/you.

        perl Makefile.PL PREFIX=/home/me/perllib # or
        perl Makefile.PL LIB=/home/me/perllib # ?


        I've not had any need to use either - but I think PREFIX is the one you're after. Give it a try and just check where it puts things. For me, on Win32, when I do 'perl Makefile.PL PREFIX=D:/test', everything gets placed in 'D:/test/lib' - so it becomes necessary for me to use lib 'D:/test/lib'; in my script if that script needs to load such a module.

        You might also consider 'INSTALL_BASE' if 'PREFIX' doesn't do what you want. From 'perldoc ExtUtils::MakeMaker':
        INSTALL_BASE can be passed into Makefile.PL to change where your modul +e will be installed. INSTALL_BASE is more like what everyone else calls "prefix" than PREFIX is. To have everything installed in your home directory, do the following. perl Makefile.PL INSTALL_BASE=~

        Cheers,
        Rob