Re: [xml] makefile for libxml2 wrong with threads

On Wed, Jun 26, 2002 at 03:10:24PM +0100, Gary Pennington - Solaris Kernel Technology wrote:
There is a problem in the libxml2 build environment if you are building the
library with support for threads.

If you examine the makefile, the target which generates the library, i.e. the target, (through libtool) should have $(THREAD_CFLAGS) and
$(THREAD_LIBS) added to it.

I guess that they should be actually added to a subsidiary target, maybe
libxml2_la_LDFLAGS or LIBS. I don't know...

If you don't have these flags, then the library isn't properly linked with the
required thread libraries and this can cause problems for applications which
then aren't explicitly linked with libpthread themselves.

(This is a particular problem for single threaded applications which are using
a which was built with threading enabled. This class of application
will cause to dump core.)

So, although I can hack a makefile to make it right, I'm not at all familiar
in the use of autoconf and friends, so I can't work out what actually needs
to be done to get the build environment corrected.

Is there anyone out there who can sort this out and submit a patch to the
list to the appropriate file which implements the change I've described


Well, I didn't see any answers to this - so I've taken a stab at the required
patch myself.

I believe that it's which needs to changes as follows:

bash-2.03# diff -c ~garypen/orig/libxml2-2.4.22/***  Fri May 24 03:35:13 
--- /home/garypen/LIB_XML_BUILD/libxml2-2.4.22/      Mon Jul  1 15:06:29 2002
*** 13,19 ****
! libxml2_la_LIBADD = @Z_LIBS@ $(ICONV_LIBS) -lm
  libxml2_la_LDFLAGS = -version-info @LIBXML_VERSION_INFO@
--- 13,19 ----
! libxml2_la_LIBADD = @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm
  libxml2_la_LDFLAGS = -version-info @LIBXML_VERSION_INFO@
This change correctly introduces -lpthread onto the link line in the makefile
for the target.

I've tested the patch using --with-threads, in which case I get the appropriate
linkage for to -lpthread, and without it, in which case -lpthread
is correctly ommited from the link step.


Attachment: pgpn3dNU1kpyv.pgp
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]