1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-04 01:47:02 +03:00

Handle ICU_LIBS as LIBADD, not LDFLAGS to prevent linking errors

For https://bugzilla.gnome.org/show_bug.cgi?id=677606
For https://bugs.gentoo.org/show_bug.cgi?id=417539

If libxml2-2.8.0 is built with --with-icu --with-python on a system that has an
older version of libxml2 installed, then during "make install", libxml2mod.so
gets relinked to the systemwide version of libxml2.so.2 instead of libxml2.so.2
from the build tree, and fails at runtime if symbol versions from the older
libxml2.so.2 are not available. This effectively makes it impossible to build a
libxml2-2.8.0 binary package on a system that does not already have
libxml2-2.8.0 installed.

Investigation by Rafał Mużyło and Arfrever Frehtes Taifersar Arahesis revealed
the cause of the problem to be that libxml2's configure was adding ICU_LIBS to
LDFLAGS instead of to LIBADD. This resulted in GNU libtool using the wrong
argument order in its relinking command that gets run during "make install".
This commit is contained in:
Arfrever Frehtes Taifersar Arahesis 2012-08-28 22:16:50 +08:00 committed by Daniel Veillard
parent 961b535c10
commit 1f01f49ba6
4 changed files with 11 additions and 10 deletions

View File

@ -20,7 +20,7 @@ bin_PROGRAMS = xmllint xmlcatalog
bin_SCRIPTS=xml2-config
lib_LTLIBRARIES = libxml2.la
libxml2_la_LIBADD = $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
if USE_VERSION_SCRIPT
LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms

View File

@ -98,7 +98,7 @@ dnl
dnl zlib option might change flags, so we save them initially
dnl
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"
_libs="${LIBS}"
AC_ARG_WITH(c14n,
[ --with-c14n add the Canonicalization support (on)])
@ -155,7 +155,7 @@ AC_ARG_WITH(readline,
if test "$withval" != "no" -a "$withval" != "yes"; then
RDL_DIR=$withval
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
LIBS="${LIBS} -L$withval/lib"
fi
])
AC_ARG_WITH(regexps,
@ -191,7 +191,7 @@ AC_ARG_WITH(zlib,
if test "$withval" != "no" -a "$withval" != "yes"; then
Z_DIR=$withval
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
LIBS="${LIBS} -L$withval/lib"
fi
])
AC_ARG_WITH(lzma,
@ -199,7 +199,7 @@ AC_ARG_WITH(lzma,
if test "$withval" != "no" -a "$withval" != "yes"; then
LZMA_DIR=$withval
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
LIBS="${LIBS} -L$withval/lib"
fi
])
AC_ARG_WITH(coverage,
@ -429,7 +429,7 @@ AC_SUBST(LZMA_LIBS)
AC_SUBST(WITH_LZMA)
CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}
LIBS=${_libs}
echo Checking headers
@ -1378,14 +1378,14 @@ XML_LIBTOOLLIBS="libxml2.la"
AC_SUBST(WITH_ICONV)
WITH_ICU=0
ICU_LIBS=""
if test "$with_icu" != "yes" ; then
echo Disabling ICU support
else
ICU_CONFIG=icu-config
if ${ICU_CONFIG} --cflags >/dev/null 2>&1
then
ICU_LIBS=`icu-config --ldflags`
LDFLAGS="$LDFLAGS $ICU_LIBS"
ICU_LIBS=`${ICU_CONFIG} --ldflags`
WITH_ICU=1
echo Enabling ICU support
else
@ -1393,6 +1393,7 @@ else
fi
fi
AC_SUBST(WITH_ICU)
AC_SUBST(ICU_LIBS)
WITH_ISO8859X=1
if test "$WITH_ICONV" != "1" ; then

View File

@ -8,5 +8,5 @@ Name: libXML
Version: @VERSION@
Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2 @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
Cflags: -I${includedir} @XML_INCLUDEDIR@ @XML_CFLAGS@

View File

@ -9,5 +9,5 @@ Version: @VERSION@
Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2
Libs.private: @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@