Click here to get back home

building GD using a locally-installed libgd (old libgd also present on system)

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
building GD using a locally-installed libgd (old libgd also present on system) jmg3000 11-10-2006
Posted by jmg3000 on November 10, 2006, 11:54 am
Please log in for more thread options


I'm trying to build GD, but have it use a libgd (Boutell's C library)
that I built in my own ~/opt directory. The problem is, there's also an
older libgd installed on the system (2.0.9 I think), but I don't have
root access and so cannot remove this older version. I want GD to
eventually get installed into ~/perllib.

I've tried "perl Makefile.PL PREFIX=/home/me/perllib", but
unfortunately, it's finding the gd.h in /usr/include (the old one)
instead of /home/me/opt/include (the current one), and it's causing the
build to fail.

How can I get GD to build correctly using my own locally-installed
libgd on a system that also has an older libgd present?


Posted by Sisyphus on November 10, 2006, 12:58 pm
Please log in for more thread options



> I'm trying to build GD, but have it use a libgd (Boutell's C library)
> that I built in my own ~/opt directory. The problem is, there's also an
> older libgd installed on the system (2.0.9 I think), but I don't have
> root access and so cannot remove this older version. I want GD to
> eventually get installed into ~/perllib.
>
> I've tried "perl Makefile.PL PREFIX=/home/me/perllib", but
> unfortunately, it's finding the gd.h in /usr/include (the old one)
> instead of /home/me/opt/include (the current one), and it's causing the
> build to fail.
>
> How can I get GD to build correctly using my own locally-installed
> libgd on a system that also has an older libgd present?
>

Probably easiest to just do some appropriate harcoding in the Makefile.PL.
(This is what I do on Win32, and it works for me.)

Find the'LIBS' and 'INC' entries in the WriteMakefile() section of said
Makefile.PL and change them to something like:

'LIBS' => [join(' ','/home/me/opt/lib',@LIBPATH,@LIBS)],
'INC' => join(' ','/home/me/opt/include',@INC),

Then just run 'make clean' and start over again - responding to all prompts
as usual.

You haven't told us where libgd is so I've had a guess that it's in
/home/me/opt/lib - which, of course, is not necessarily the case.

Cheers,
Rob



Posted by jmg3000 on November 10, 2006, 3:04 pm
Please log in for more thread options


Sisyphus wrote:
> [snip]
> >
> > How can I get GD to build correctly using my own locally-installed
> > libgd on a system that also has an older libgd present?
> >
>
> Probably easiest to just do some appropriate harcoding in the Makefile.PL.
> (This is what I do on Win32, and it works for me.)
>
> Find the'LIBS' and 'INC' entries in the WriteMakefile() section of said
> Makefile.PL and change them to something like:
>
> 'LIBS' => [join(' ','/home/me/opt/lib',@LIBPATH,@LIBS)],
> 'INC' => join(' ','/home/me/opt/include',@INC),
>
> Then just run 'make clean' and start over again - responding to all prompts
> as usual.

Hm. Seems like there ought to be an easier way...

> You haven't told us where libgd is so I've had a guess that it's in
> /home/me/opt/lib [snip]

Yup. That's the place.

Well, anyway, after changing those lines in Makefile.PL, creating the
makefile seems to still have issues:

=== snip ===
$ perl Makefile.PL PREFIX=/home/me/perllib
Configuring for libgd version 2.0.33.
Checking for stray libgd header files...

** WARNING: found gd.h header file in /usr/includegd.h, but it is
expected at /home/me/opt/include/gd.h. This may cause compile errors!
**


** WARNING: found gd.h header file in /usr/include/gd.h, but it is
expected at /home/me/opt/include/gd.h. This may cause compile errors!
**
** Possible problems found **

Included Features: GD_XPM GD_JPEG GD_FONTCONFIG GD_FREETYPE
GD_PNG GD_GIF GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33
GD library used from: /home/me/opt
Checking if your kit is complete...
Looks good
Warning: prerequisite Math::Trig 0 not found.
Unrecognized argument in LIBS ignored: '/home/me/opt/lib'
Writing Makefile for GD
=== /snip ===

After that, I run make, and it seems to work fine:

=== snip ===
$ make
cp GD/Polyline.pm blib/lib/GD/Polyline.pm
cp qd.pl blib/lib/qd.pl
cp GD/Image.pm blib/lib/GD/Image.pm
cp GD/Simple.pm blib/lib/GD/Simple.pm
cp GD.pm blib/lib/GD.pm
AutoSplitting blib/lib/GD.pm (blib/lib/auto/GD)
cp GD/Polygon.pm blib/lib/GD/Polygon.pm
/usr/bin/perl5.8.0 /usr/lib/perl5/5.8.0/ExtUtils/xsubpp -typemap
/usr/lib/perl5/5.8.0/ExtUtils/typemap -typemap typemap GD.xs > GD.xsc
&& mv GD.xsc GD.c
cc -c /home/me/opt/include -I/home/me/opt/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 -DHAVE_XPM -DHAVE_GIF -DHAVE_PNG -DHAVE_ANIMGIF
-DVERSION_33 -DHAVE_UNCLOSEDPOLY -DHAVE_FONTCONFIG -DHAVE_FTCIRCLE GD.c
cc: /home/me/opt/include: linker input file unused because linking not
done
Running Mkbootstrap for GD ()
chmod 644 GD.bs
rm -f blib/arch/auto/GD/GD.so
LD_RUN_PATH="/usr/X11R6/lib:/usr/lib" cc -shared -L/usr/local/lib GD.o
-o blib/arch/auto/GD/GD.so -L/usr/lib -L/usr/X11R6/lib
-L/home/me/opt/lib -lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng12
-lz -lm -lgd
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
cp bdf_scripts/bdf2gdfont.pl blib/script/bdf2gdfont.pl
/usr/bin/perl5.8.0 "-MExtUtils::MY" -e "MY->fixin(shift)"
blib/script/bdf2gdfont.pl
Manifying blib/man3/GD::Polyline.3
Manifying blib/man1/bdf2gdfont.pl.1
Manifying blib/man3/GD::Image.3
Manifying blib/man3/GD.3
Manifying blib/man3/GD::Simple.3
Manifying blib/man3/GD::Polygon.3
=== /snip ===

But "make test" fails:

=== snip ===
$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.8.0 "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/GD..........Can't load './blib/arch/auto/GD/GD.so' for module GD:
./blib/arch/auto/GD/GD.so: undefined symbol: gdImageGifAnimAddPtr at
/usr/lib/perl5/5.8.0/i386-linux/DynaLoader.pm line 229.
at t/GD.t line 14
Compilation failed in require at t/GD.t line 14.
BEGIN failed--compilation aborted at t/GD.t line 14.
t/GD..........dubious

Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-12
Failed 12/12 tests, 0.00% okay
t/Polyline....Can't load
'/home/me/opt/src/perl_modules/GD-2.35/blib/arch/auto/GD/GD.so' for
module GD:
/home/me/opt/src/perl_modules/GD-2.35/blib/arch/auto/GD/GD.so:
undefined symbol: gdImageGifAnimAddPtr at
/usr/lib/perl5/5.8.0/i386-linux/DynaLoader.pm line 229.
at /home/me/opt/src/perl_modules/GD-2.35/blib/lib/GD/Polyline.pm line
45
Compilation failed in require at
/home/me/opt/src/perl_modules/GD-2.35/blib/lib/GD/Polyline.pm line 45.
BEGIN failed--compilation aborted at
/home/me/opt/src/perl_modules/GD-2.35/blib/lib/GD/Polyline.pm line 45.
Compilation failed in require at t/Polyline.t line 10.
BEGIN failed--compilation aborted at t/Polyline.t line 10.
t/Polyline....dubious

Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED test 1
Failed 1/1 tests, 0.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/GD.t 255 65280 12 23 191.67% 1-12
t/Polyline.t 255 65280 1 2 200.00% 1
Failed 2/2 test scripts, 0.00% okay. 13/13 subtests failed, 0.00% okay.
make: *** [test_dynamic] Error 255
=== /snip ===

That ./blib/arch/auto/GD/GD.so does indeed exist. Line 14 of GD.t is:
"use GD qw(:DEFAULT GD_CMP_IMAGE);".

After that, "make install" seems to work fine.

For kicks, I tried out the demos anyway. I added "use lib
'/home/me/perllib';" and they wouldn't work. Then I tried "use lib
'/home/me/perllib/lib/perl5/site_perl/5.8.0/i386-linux';", and, to my
surprise, they worked. The sample cgi script also worked.

Why did "make test" fail?


Posted by jmg3000 on November 10, 2006, 3:10 pm
Please log in for more thread options



jmg3...@gmail.com wrote:
> [snip]
>
> After that, "make install" seems to work fine.
>
> For kicks, I tried out the demos anyway. I added "use lib
> '/home/me/perllib';" and they wouldn't work. Then I tried "use lib
> '/home/me/perllib/lib/perl5/site_perl/5.8.0/i386-linux';", and, to my
> surprise, they worked. The sample cgi script also worked.
>
> Why did "make test" fail?

Hm. Also note:

~/opt/src/perl_modules/GD-2.35/blib/arch/auto/GD$ ldd ./GD.so
[snip]
libgd.so.2 => /usr/lib/libgd.so.2 (0x0030a000)
[snip]

So, it's not even using my new libgd.


Posted by Sisyphus on November 10, 2006, 8:41 pm
Please log in for more thread options



> Sisyphus wrote:
.
.
> > Find the'LIBS' and 'INC' entries in the WriteMakefile() section of said
> > Makefile.PL and change them to something like:
> >
> > 'LIBS' => [join(' ','/home/me/opt/lib',@LIBPATH,@LIBS)],
> > 'INC' => join(' ','/home/me/opt/include',@INC),
> >
> > Then just run 'make clean' and start over again - responding to all
prompts
> > as usual.
>
.
.
>
> ** WARNING: found gd.h header file in /usr/includegd.h, but it is
> expected at /home/me/opt/include/gd.h. This may cause compile errors!
> **
>
>
> ** WARNING: found gd.h header file in /usr/include/gd.h, but it is
> expected at /home/me/opt/include/gd.h. This may cause compile errors!
> **

You're sure that /home/me/opt/include/gd.h exists ? .... it's not (eg)
/home/me/opt/include/gd/gd.h ?

How about:

'LIBS' => [join(' ','-L/home/me/opt/lib',@LIBPATH,@LIBS)],
'INC' => join(' ','-I/home/me/opt/include',@INC),

(Sorry about that ... without the '-L' and '-I' switches those first
elements achieve nothing.)

Turns out that on Win32, all I really need to do is have:

'LIBS' => [join(' ',@LIBPATH,@LIBS)],
'INC' => join(' ',@INC),

And both gd.h and libgd.a are found correctly - so long as I provide the
correct location of libgd.a when prompted by the Makefile.PL. Based on the
reported location of your gd.h and libgd.a, the same should be happening for
you .... don't knowwhy that's not the case. Anyway, try inserting the '-L'
and '-I' (that's uppercase i) and see if that helps. (For me, libgd.a is in
D:/MSYS/local/lib and gd.h is in D:/MSYS/local/include.)

Cheers,
Rob



Similar ThreadsPosted
Problems building Javascript-1.00 on Win32 system November 11, 2006, 9:59 pm
system return value? January 26, 2007, 5:52 pm
Question about building modules on W2K September 24, 2004, 7:09 am
Problem building DBD::Oracle on 64 bit solaris April 13, 2005, 2:51 pm
ld synbol errors building XML::Parser on AIX 5.2 June 30, 2005, 2:10 pm
Building Math::Pari using Sun Studio 11 October 16, 2006, 11:46 am
Building Text::Iconv on Windows September 30, 2007, 9:58 am
Win32::GUI newbie question re dynamic GUI building October 6, 2005, 8:44 pm
Building Perl module GD::Text on Solaris 10 August 3, 2007, 3:37 pm
IO::Pty - reads/writes fail *only* with system() January 10, 2006, 1:59 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap