On Mon, Jul 25, 2011 at 09:06:41PM +0200, Florian Pflug wrote:
> On Jul25, 2011, at 20:37 , Bernd Helmle wrote:
> > Ah, but i got now what's wrong here: configure is confusing both libxml2
> > installations, and a quick look into config.log proves that: it uses the
> > xml2-config from the OSX libs (my $PATH has /usr in front of the bindir of
> > MacPorts, though i seem to recall to have changed this in the past....).
> Hm, but I still think there's a bug lurking there. Using a different libxml2
> version for the configure checks than for actual builds surely isn't good...
>
> From looking at configure.in, it seems that we use xml2-config to figure out
> the CFLAGS and LDFLAGS required to build and link against libxml. I guess we
> somehow end up not using these flags when we later test for
> xmlStructuredErrorContext, but do use them during the actual build. Or maybe
> the order of the -I and -L flags just ends up being different in the two cases.
I can reproduce similar behavior on GNU/Linux. If my setup was sufficiently
similar, Bernd's problematic build would have used this sequence of directives
during both configuration and build:
-I/usr/include/libxml2 -I/opt/local/include -L/opt/local/lib
The directories passed using --with-includes and --with-libraries took
priority over those from xml2-config. Since libxml2 headers live in a
`libxml2' subdirectory, --with-includes=/opt/local/include did not affect
finding them. --with-libraries=/opt/local/lib *did* affect finding the
library binaries, though. Therefore, he built entirely against /usr headers
and /opt/local libraries. We could rearrange things so the xml2-config -L
flags (or lack thereof) take priority over a --with-libraries directory for
the purpose of finding libxml2.
As a side note, we don't add an rpath for libxml2 like we do for Perl and
Python. That doesn't matter on Darwin, but with GNU libc, it entails setting
LD_LIBRARY_PATH or updating /etc/ld.so.conf to make the run time linker find
the library binary used at build time.
--
Noah Misch http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services