develooper Front page | perl.perl5.porters | Postings from December 2004

Re: Static linking XML::Parser --- Lengthy Saga

Thread Previous | Thread Next
From:
Bennett Todd
Date:
December 28, 2004 11:03
Subject:
Re: Static linking XML::Parser --- Lengthy Saga
Message ID:
20041228190307.GA2456@rahul.net
[ In case anyone is interested, this is a log of my attempts to get
  XML::Parser statically linked into perl 5.8.6. The meat of how to
  do the deed, the result absent description of all the failed
  attempts en route, is in a separate posting entitled
  "Success! XML::Parser static link HOWTO" ]

2004-12-28T16:07:05 Bennett Todd:
> I'll go back to trying to get an all-in-one package working. Will
> report back if I succeed, or give up.

To recap, I'm trying to put XML::Parser in ext/ in the perl build
tree for a -Uusedl static build.

Just unpacking it there, leaving it in
ext/XML-Parser-2.34/{Parser,Expat}/ produces a build of a static
perl, where any attempt to load XML::Parser gives an error that
dynamic loading isn't available for Expat; XML/Parser/Expat doesn't
get into static_exts.

Moving the XML-Parser-2.34 dir to XML/Parser fails, in the same way
as leaving it where it is and explicitly using -A
static_exts=XML/Parser/Expat, with Configure's module enumeration
getting confused and leaving out most of the core XS modules. [NB:
this paragraph is from memory, I'm certain I tried both of these,
and got failures, and I'm remembering that they failed the same way,
but unfortunately I hadn't yet started this journal].

I tried leaving ext/XML-Parser-2.34/ where it is, but moving it's
Expat/ subdir to XML/Parser/Expat; the resulting config.sh looked
great, with all the builtin core utils where they should be,
XML-Parser-2.34 in nonxs_ext, and XML/Parser/Expat in static_ext,
but the build ended up looping saying:

> Warning: PERL_LIB (../../ [ growing list of../] /../lib) seems not to be a perl library directory
>         (Exporter.pm not found) at ../../lib/ExtUtils/MM_Unix.pm line 1881.
> Couldn't change to directory /var/tmp/bpmbuild.17328/build/perl-5.8.6/ext/XML-Parser-2.34/Expat: No such file or directory at ./Makefile.PL line 91
> Checking if your kit is complete...
> Warning: the following files are missing in your kit:
>         Expat/encoding.h
>         Expat/Expat.pm
>         Expat/Expat.xs
>         Expat/Makefile.PL
>         Expat/typemap
> Please inform the author.
>
> You cannot build extensions below the perl source tree after executing
> a 'make clean' in the perl source tree.
>
> To rebuild extensions distributed with the perl source you should
> simply Configure (to include those extensions) and then build perl as
> normal. After installing perl the source tree can be deleted. It is
> not needed for building extensions by running 'perl Makefile.PL'
> usually without extra arguments.
>
> It is recommended that you unpack and build additional extensions away
> from the perl source tree.

which goes along with Nicholas Clark's advice, but doesn't seem to
have full working support for static perl builds with no dynloader
--- the separate build was happy, but while it installed pms and
Expat.a and so on, I couldn't see any perl binary or makefile target
to build one.

Given the above errors, I tried again, this time adding a symlink
ext/XML-Parser-2.34/Expat -> ../XML/Parser/Expat, and that seemed to
be closer, but still no cigar:

>         Making XML-Parser-2.34 (nonxs)
> Checking if your kit is complete...
> Warning: the following files are missing in your kit:
>         Expat/encoding.h
>         Expat/Expat.pm
>         Expat/Expat.xs
>         Expat/Makefile.PL
>         Expat/typemap
> Please inform the author.
>
> You cannot build extensions below the perl source tree after executing
> a 'make clean' in the perl source tree.
>
> To rebuild extensions distributed with the perl source you should
> simply Configure (to include those extensions) and then build perl as
> normal. After installing perl the source tree can be deleted. It is
> not needed for building extensions by running 'perl Makefile.PL'
> usually without extra arguments.
>
> It is recommended that you unpack and build additional extensions away
> from the perl source tree.
> Warning: PERL_LIB (../../../lib) seems not to be a perl library directory
>         (Exporter.pm not found) at ../../lib/ExtUtils/MM_Unix.pm line 1881.
> Writing Makefile for XML::Parser::Expat
> Writing Makefile for XML::Parser
> make[1]: Entering directory `/var/tmp/bpmbuild.20822/build/perl-5.8.6/ext/XML-Parser-2.34'
> make[1]: Leaving directory `/var/tmp/bpmbuild.20822/build/perl-5.8.6/ext/XML-Parser-2.34'
> make[1]: Entering directory `/var/tmp/bpmbuild.20822/build/perl-5.8.6/ext/XML-Parser-2.34'
> cp Parser/Encodings/x-sjis-cp932.enc ../../lib/XML/Parser/Encodings/x-sjis-cp932.enc
> [ lots more of the same ]
>  cp Parser/Encodings/iso-8859-5.enc ../../lib/XML/Parser/Encodings/iso-8859-5.enc
> make[2]: Entering directory `/var/tmp/bpmbuild.20822/build/perl-5.8.6/ext/XML/Parser/Expat'
> make[2]: *** No rule to make target `../../../config.sh', needed by `../../../lib/Config.pm'.  Stop.
> make[2]: Leaving directory `/var/tmp/bpmbuild.20822/build/perl-5.8.6/ext/XML/Parser/Expat'
> make[1]: *** [subdirs] Error 2
> make[1]: Leaving directory `/var/tmp/bpmbuild.20822/build/perl-5.8.6/ext/XML-Parser-2.34'
> make: *** [ext/XML-Parser-2.34/pm_to_blib] Error 2

So next I tried something different, decoupling the Expat and Parser
modules, by moving ext/XML-Parser-2.34/Expat to
ext/XML/Parser/Expat/, and diking out the explicit build hooks to
Expat from XML-Parser-2.34/Makefile.PL.

And that worked! I'll post the perl build commands and
XML-Parser-2.34/Makefile.PL patch separately under the subject
"Success! XML::Parser static link HOWTO".

My conclusion is that it'd be Good to decouple those two packages in
CPAN. How common are such coupled packages that'd require teasing
apart for a successful static build?

-Bennett

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About