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

I have been attempting to configure my own, non-ancient version of GD. Due to my administrator's various vices, the facts that his version is ancient and that it isn't built to support JPEG have not been addressed.

Here is a log of me installing GD 2.06 into my home directory without a hitch. /home/***/lib is where my libgd (2.0.15) is contained.

[***@******//~/GD-2.06] perl Makefile.PL PR EFIX=/home/*** NOTICE: This module requires libgd 2.0.5 or higher. it will NOT work with earlier versions. For earlier versions of libgd, use GD version 1.41. Where is libgd installed? [/usr/lib] /home/***/lib Please choose the features that match how libgd was built: Build JPEG support? [y] y Build FreeType support? [y] n Build XPM support? [y] n If you experience compile problems, please check the @INC, @LIBPATH an +d @LIBS arrays defined in Makefile.PL and manually adjust, if necessary. Writing Makefile for GD [***@******//~/GD-2.06] make cc -c -I/home/***/include -I/usr/local/include -I/usr/local/include/g +d -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FI +LE_OFFSET_BITS=64 -O2 -DVERSION=\"2.06\" -DXS_VERSION=\"2.06\" -fpi +c "-I/usr/lib/perl5/i386-linux/CORE" -DHAVE_JPEG GD.c Running Mkbootstrap for GD () chmod 644 GD.bs rm -f blib/arch/auto/GD/GD.so LD_RUN_PATH="/home/***/lib:/usr/lib:/lib" cc -shared -L/usr/local/lib + GD.o -o blib/arch/auto/GD/GD.so -L/home/***/lib -L/usr/X11R6/lib +-L/usr/local/lib -lgd -lpng -lz -ljpeg -lm chmod 755 blib/arch/auto/GD/GD.so cp GD.bs blib/arch/auto/GD/GD.bs chmod 644 blib/arch/auto/GD/GD.bs Manifying blib/man3/GD.3 Manifying blib/man3/GD::Polyline.3 [***@******//~/GD-2.06] make install Installing /home/***/lib/perl5/site_perl/i386-linux/auto/GD/GD.so Installing /home/***/lib/perl5/site_perl/i386-linux/auto/GD/GD.bs Files found in blib/arch: installing files in blib/lib into architectu +re dependent library tree Installing /home/***/lib/perl5/site_perl/i386-linux/qd.pl Installing /home/***/lib/perl5/site_perl/i386-linux/GD.pm Installing /home/***/lib/perl5/site_perl/i386-linux/GD/Polyline.pm Installing /home/***/lib/perl5/site_perl/i386-linux/auto/GD/autosplit. +ix Writing /home/***/lib/perl5/site_perl/i386-linux/auto/GD/.packlist Appending installation info to /home/***/lib/perl5/site_perl/i386-linu +x/perllocal.pod
When I attempt to run my test script to see if GD is the proper version, this happens:
[***@******//~] cat gdtest.pl use lib '/home/***/lib'; use GD; print "$GD::VERSION\n"; [***@******//~] perl gdtest.pl 1.32
Indicating that the module being loaded is my administrator's ancient version of GD. One other thing that I noted was that when I attempted to load GD.pm from ~/lib/perl5/site_perl/i386-linux, I got a wierd error:
[***@******//~/lib/perl5/site_perl/i386-linux] perl GD.pm GD object version 1.32 does not match $GD::VERSION 2.06 at /usr/lib/pe +rl5/i386-linux/DynaLoader.pm line 219.
So basically, I have two questions:
How can I make sure the GD I use is the one located in ~/lib/perl5/site_perl/i386-linux, and
How can I fix that wierd error about the GD object being version 1.32?

I suspect the two questions are causally related.

Replies are listed 'Best First'.
Re: Installing personal GD
by blokhead (Monsignor) on Aug 24, 2003 at 00:48 UTC
    Installing /home/***/lib/perl5/site_perl/i386-linux/GD.pm
    The module is getting installed to ~/lib/perl5/site_perl/i386-linux, but you only added ~/lib to your library path. Try the whole path:
    use lib '/home/anonymonk/lib/perl5/site_perl/i386-linux'; use GD; print "$GD::VERSION\n";
    When you changed to that directory and ran GD.pm from the command line, Perl's library path still had all the stuff in /usr at the beginning, so it found the old *.so file before it searched the current directory. But use lib adds paths at the beginning of the list of library paths.

    blokhead

      I'd recommend use lib '/home/anonymonk/lib/perl5/site_perl'; over the path with 'i386-linux'. Perl automatically adds architecture-specific subdirectories. So, without it, you also cover the case for pure-Perl modules.
      Thanks guys. Anyway,

      [***@******//~] cat gdtest.pl use lib '/home/***/lib/perl5/site_perl/i386-linux'; use GD; print "$GD::VERSION\n"; [***@******//~] perl gdtest.pl 2.06


      Seems to have yielded the correct version number. I tried using lib '/home/anonymonk/lib/perl5/site_perl' but the i386-linux directory where GD was installed wasn't being included. Anyway, that seems to have fixed it.
OT: Compiling statically linked GD
by dont_you (Hermit) on Aug 24, 2003 at 05:21 UTC
    By the way... someone knows how to build a static version of GD without rebuild an entire perl?
    I'd like to copy GD.bs, GD.so, etc. to systems where I do not have shell access, but run the same OS. I've done this sucessfully with Compress::Zlib, for example, but I failed with GD.
    Thanks in advance.
    José
Re: Installing personal GD
by jmanning2k (Pilgrim) on Aug 26, 2003 at 17:35 UTC
    Try installing to a more basic lib directory: change your Makefile.PL line to:
    perl Makefile.PL PREFIX=/home/xxx LIB=/home/xxx/lib

    As for your static question, I looked at the GD sources, and didn't see an easy way to do that. There is no ./configure script. You might try copying the gcc line from the Makefile, and inserting -static as an option to gcc.