[Expat-discuss] Re: troubles with expat sol 8/gcc/xml-parser

Fred L. Drake, Jr. fdrake@acm.org
Tue Aug 6 14:08:02 2002


Josh Martin writes:
 > Ah, see, there's the rub.  If you're writing an extension for Perl
 > (at least in C) then you must either build it as a dynamic library,
 > or you have to have to statically link it in to perl itself,

This is similar to Python; those are the only two options.

 > meaning recompiling perl. Now, I'm rather vague on static versus
 > dynamic libraries on solaris, but I think it should be possible to
 > build the XML-Parser module dynamically (as normal) but link the
 > expat library into it statically when you build it.  That is,
 > assuming you only built a static version of expat.  You might (but
 > shouldn't) need to get so drastic as to edit the XML::Parser
 > makefile and add the '-lexpat' compiler switch (possibly along with
 > the '-L' compiler switch specifying the directory expat was
 > installed to if it's not in your libpath).

It should be quite easy to construct the link line, but if the .so
libraries are installed in the same place as the static lib, using
-l/-L probably won't work since those usually default to linking the
dynamic library.  There will be some other option to force the library
to be linked statically (-static or something like that), or you can
name the .a file explicitly instead of using the -l/-L options at
all.

What we do for Python (PyXML and Python 2.3+) is actually include the
Expat library sources in the distribution and link the .o files
directly into the extension, instead of using the library file at
all.  This actually seems to work quite well.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation