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, 10:07 pm
Please log in for more thread options


Sisyphus wrote:
> > 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),
> > >
> [snip]
>
> You're sure that /home/me/opt/include/gd.h exists ? .... it's not (eg)
> /home/me/opt/include/gd/gd.h ?

Yup to the former. That header is where it's supposed to be.

> 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.)

Whoops. That slipped by me too. I made the change, but still get the
same results. (Incidentally, I noticed that, in the resulting makefile,
there's some duplication now, with that path getting mentioned in a
number of places twice in a row).

> Turns out that on Win32, all I really need to do is have:
>
> 'LIBS' => [join(' ',@LIBPATH,@LIBS)],
> 'INC' => join(' ',@INC),

Hm.

> 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.

Wait. How is it that you're getting prompted somehow for libgd.a? I'd
be happy to statically link to libgd.a, but don't yet know how. How do
I tell GD's Makefile.PL that I'd like to statically link to libgd? That
would actually solve my problem here pretty nicely. When I built libgd,
I got both the .so and the .a in ~/opt/lib.

BTW, currently, when running "perl Makefile.PL LIB=/home/me/perllib",
I'm not getting prompted for anything, since the new libgd I built has
its own gdlib-config in ~/opt/bin which is evidently being used
correctly by GD's Makefile.PL.

Thanks for all the help! :)

---John


Posted by Sisyphus on November 11, 2006, 12:43 am
Please log in for more thread options



.
.

> Wait. How is it that you're getting prompted somehow for libgd.a?

From the Makefile.PL:

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

But, of course, $lib_gd_path will already have been defined for you by
gdlib-config - which is not being found in my case. I do have gdlib-config,
but my cmd.exe shell wouldn't be able to use it directly - even if it could
find it.

I just keep thinking that there must be some hardcoded 'LIBS' and 'INC'
entry that will do the trick - since that's what gets used to write the
makefile.

> I'd
> be happy to statically link to libgd.a, but don't yet know how. How do
> I tell GD's Makefile.PL that I'd like to statically link to libgd? That
> would actually solve my problem here pretty nicely. When I built libgd,
> I got both the .so and the .a in ~/opt/lib.

I thought that '-lgd' would have the linker link to 'libgd.a' rather than
'libgd.so' - because it would use the first file it finds and it would find
libgd.a before finding libgd.so. (I could be wrong about that, too.)
Is the .a a static library ? ... or is it merely an import library for the
.so ?

In my case, libgd.a *is* a static library - there is *no* shared library.
And I had to therefore take the additional step of altering the 'DEFINES'
entry in the WriteMakefile() section to:

'DEFINES' => $defines . " -DNONDLL"

The same may not apply in non-windows environments. If it *does* apply then
it's unlikely to be '-DNONDLL' - more likely something like '-DNONSO'.

In any case, if the .a is just an import lib for the .so, then you shouldn't
have to worry about any of that.

>
> BTW, currently, when running "perl Makefile.PL LIB=/home/me/perllib",
> I'm not getting prompted for anything, since the new libgd I built has
> its own gdlib-config in ~/opt/bin which is evidently being used
> correctly by GD's Makefile.PL.
>

Yes - and I don't know why is allowing the /usr/include/gd.h to get in the
way. Might pay to run 'gdlib-config --all' and check that it's not throwing
up something you don't want.

> Thanks for all the help! :)
>

Hmmm ... I fear that all I have yet provided is more appropriately
classified as "red herrings" rather than "help" :-)

I've just fired up my linux box. Initially I got warnings, too, about
another gd.h in /usr/include. Renaming it (and gd_io.h) so that they
wouldn't get found fixed that - but didn't make any difference when it came
to building GD. 'make' runs ok, but the perl GD.so cannot be loaded because
of an undefined symbol - different symbol to the one that's tripping you up.
I have only gd-2.0.28, and I'm not confident that's sufficiently recent for
GD-2.35 (despite the claim made by the Makefile.PL).

I don't know why that animated gif symbol is not being resolved for you. If
you don't need animated gif support you could try building GD-2.35 without
it - but that's another kludge you should not have to be bothered with.

Cheers,
Rob



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


Sisyphus wrote:
> [sinp]
>
> I just keep thinking that there must be some hardcoded 'LIBS' and 'INC'
> entry that will do the trick - since that's what gets used to write the
> makefile.

Possibly. Though, I'm now guessing the "right way"(tm) to do it is to
set various variables on the "perl Makefile.PL FOO=bar" command line as
described in the ExtUtils::MakeMaker docs. I've tried various
combinations of those, but have not had any luck. For example, tried:

perl Makefile.PL LIB=/home/me/perllib LINKTYPE=static
INC=/home/me/opt/include LIBS=/home/me/opt/lib/libgd.a

and

perl Makefile.PL LIB=/home/me/perllib LINKTYPE=static
INC=/home/me/opt/include LIBS=/home/me/opt/lib

with no luck.

> > I'd
> > be happy to statically link to libgd.a, but don't yet know how. How do
> > I tell GD's Makefile.PL that I'd like to statically link to libgd? That
> > would actually solve my problem here pretty nicely. When I built libgd,
> > I got both the .so and the .a in ~/opt/lib.
>
> I thought that '-lgd' would have the linker link to 'libgd.a' rather than
> 'libgd.so' - because it would use the first file it finds and it would find
> libgd.a before finding libgd.so. (I could be wrong about that, too.)

I think that '-lgd' tell the link editor to try and link in libgd.so
only.

> Is the .a a static library ? ... or is it merely an import library for the
> .so ?

It's a static lib. I think the term "import library" is a
Windows-specific thing, but I'm not familiar with it. On GNU/Linux, we
have static libs (.a) and shared libs (.so).

> In my case, libgd.a *is* a static library - there is *no* shared library.
> And I had to therefore take the additional step of altering the 'DEFINES'
> entry in the WriteMakefile() section to:
>
> 'DEFINES' => $defines . " -DNONDLL"
>
> The same may not apply in non-windows environments. If it *does* apply then
> it's unlikely to be '-DNONDLL' - more likely something like '-DNONSO'.

Dunno. Though, I still feel like MakeMaker should be smarter than this.
That is, I should be able to simply tell it to please link only to the
static lib for libgd... I'll have to research this a bit more. It's
gotta be a pretty commonly-needed thing...

> [snip]
> > Thanks for all the help! :)
> >
>
> Hmmm ... I fear that all I have yet provided is more appropriately
> classified as "red herrings" rather than "help" :-)

Then thank you for your time. :)

For now, my plan is to dig around and find out how to properly use
MakeMaker so I can tell it to statically link to libgd.

---John


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