From 1ef227e2f1230ed333b4a04d07eae4c4ce4f441d Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 28 Jun 2021 02:03:15 +0100 Subject: [PATCH] python/Makefile.am: use *_LIBADD, not *_LDFLAGS for LIBS This fixes over-linking in the built Python modules with various libraries. *_LIBADD is intended for adding additional libraries for linking, while *_LDFLAGS is for miscellaneous extra flags (possibly user-supplied). If using -Wl,-as-needed within user-supplied LDFLAGS, it is passed too late (after the library link line) and therefore has no effect. Notes: * Noticed while working on Gentoo's migration to libxcrypt because libxml2's Python modules were linking to libcrypt (and other libraries) unexpectedly. * It was suggested we could actually stop linking explicitly with all of Python's libraries / don't copy its LDFLAGS, but this resolves the original issue downstream and is a separate discussion. I couldn't find any clear documentation for/against such a change. Bug: https://bugs.gentoo.org/798942 Signed-off-by: Sam James --- python/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/Makefile.am b/python/Makefile.am index 34aed96c..726e6936 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -25,7 +25,8 @@ python_LTLIBRARIES = libxml2mod.la libxml2mod_la_SOURCES = libxml.c libxml_wrap.h libxml2-py.h libxml2-py.c types.c libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version \ - $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) + $(top_builddir)/libxml2.la +libxml2mod_la_LIBADD = $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c -- GitLab