Re: Building XML::LibXML with libs in a non-standard location

Petr Pajas <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
2009/9/25 Michael Ludwig <[email protected]>:
> Folks,
>
> I'm trying to build XML::LibXML with libs in a non-standard location.
> I want the linker to pick up the libraries in /usr/local/libxml2-git.

Michael, hope you got my reply from a mobile. Now in more detail for the list:

You would either have to pass correct INC and LIBS to Makefile.PL and
your LIBS would have to include -lxml2 etc. It is much easier however
to let Makefile.PL use the xml2-config script, which gets installed
under $prefix/bin where $prefix is /usr/local/libxml2-git/. This is
done by setting PATH to PATH=$prefix/bin:$PATH.

This should be basically equivalent to perl Makefile.PL
INC=`$prefix/bin/xml2-config --cflags` LIBS=`$prefix/bin/xml2-config
--libs`, only considerably simpler.

For runtime, you still have to set LD_LIBRARY_PATH to $prefix/lib:
(the colon means all default libraries follow) or edit ld.conf, so
that the dynamic linker finds the library in $prefix/lib first.

HTH,
   Petr

> Unfortunately, it always picks up the libraries in /usr/local instead.
> The XML::LibXML version is 1.69. The LibXML2 version is 2.7.4 in
> /usr/local and Git HEAD in the non-standard location.
>
> Here's what I've done:
>
> (1) Added /usr/local/libxml2-git/lib to /etc/ld.so.conf.d/bla.conf so it
> appears before /usr/local/lib. Which works, as shown by ldconfig -p:
>
>   libxml2.so.2 (libc6) => /usr/local/libxml2-git/lib/libxml2.so.2
>   libxml2.so.2 (libc6) => /usr/local/lib/libxml2.so.2
>   libxml2.so.2 (libc6) => /usr/lib/libxml2.so.2
>   libxml2.so (libc6) => /usr/local/libxml2-git/lib/libxml2.so
>   libxml2.so (libc6) => /usr/local/lib/libxml2.so
>   libxml2.so (libc6) => /usr/lib/libxml2.so
>
> (2) Defined LD_LIBRARY_PATH and even LD_RUN_PATH, only because ldconfig
> alone didn't make the linker aware of my new libs.
>
> LD_LIBRARY_PATH=/usr/local/libxml2-git/lib
> LD_RUN_PATH=/usr/local/libxml2-git/lib
>
> (3) Passed -L option to Makefile.PL:
>
> # perl Makefile.PL LIBS='-L/usr/local/libxml2-git/lib'
>
> Doing this, I get lots of errors:
>
> LibXML.xs:1459: error: 'xmlPedanticParserDefaultValue' undeclared
> (first use in this function)
>
> Not doing this, the build works fine, but against /usr/local, not
> against my non-standard location.
>
> What am I missing?
>
> How is it meant to work?
>
> What's the significance of the steps (1), (2) and (3) described above?
> Any of it good or bad or necessary or pointless?
>
> Michael
> _______________________________________________
> Perl-XML mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.