From a1e927c1cfcca657fddadd982c03eaed26e316d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 26 Oct 2022 12:22:09 +0200 Subject: [PATCH 1/2] gh-98707: Don't let --with-system-libmpdec / --with-system-expat use the vendored headers This was a regression in Python 3.12.0a2 that prevented Fedora doing this: $ rm -r Modules/_decimal/libmpdec $ rm -r Modules/expat Before building Python with --with-system-libmpdec --with-system-expat. The errors were: make: *** No rule to make target 'Modules/_decimal/libmpdec/basearith.h', needed by 'Modules/_decimal/_decimal.o'. Stop. make: *** No rule to make target 'Modules/expat/ascii.h', needed by 'Modules/pyexpat.o'. Stop. Now the make-dependency on the headers only exists when --with-system-libmpdec / --with-system-expat is **not** used. Fixes https://github.com/python/cpython/issues/98707 --- Makefile.pre.in | 6 +++--- .../Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst | 4 ++++ configure | 4 ++-- configure.ac | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst diff --git a/Makefile.pre.in b/Makefile.pre.in index 6ab1422c78982a..90918d9d2cfe8b 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -2581,13 +2581,13 @@ MODULE_DEPS=$(PYTHON_HEADERS) Modules/config.c $(EXPORTSYMS) MODULE_CMATH_DEPS=$(srcdir)/Modules/_math.h MODULE_MATH_DEPS=$(srcdir)/Modules/_math.h -MODULE_PYEXPAT_DEPS=$(LIBEXPAT_HEADERS) @LIBEXPAT_INTERNAL@ +MODULE_PYEXPAT_DEPS=@LIBEXPAT_INTERNAL@ MODULE_UNICODEDATA_DEPS=$(srcdir)/Modules/unicodedata_db.h $(srcdir)/Modules/unicodename_db.h MODULE__BLAKE2_DEPS=$(srcdir)/Modules/_blake2/impl/blake2-config.h $(srcdir)/Modules/_blake2/impl/blake2-impl.h $(srcdir)/Modules/_blake2/impl/blake2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2b-ref.c $(srcdir)/Modules/_blake2/impl/blake2b-round.h $(srcdir)/Modules/_blake2/impl/blake2b.c $(srcdir)/Modules/_blake2/impl/blake2s-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2s-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2s-load-xop.h $(srcdir)/Modules/_blake2/impl/blake2s-ref.c $(srcdir)/Modules/_blake2/impl/blake2s-round.h $(srcdir)/Modules/_blake2/impl/blake2s.c $(srcdir)/Modules/_blake2/blake2module.h $(srcdir)/Modules/hashlib.h MODULE__CTYPES_DEPS=$(srcdir)/Modules/_ctypes/ctypes.h $(srcdir)/Modules/_ctypes/darwin/dlfcn.h MODULE__CTYPES_MALLOC_CLOSURE=@MODULE__CTYPES_MALLOC_CLOSURE@ -MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h $(LIBMPDEC_HEADERS) @LIBMPDEC_INTERNAL@ -MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/pyexpat.c $(LIBEXPAT_HEADERS) @LIBEXPAT_INTERNAL@ +MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h @LIBMPDEC_INTERNAL@ +MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/pyexpat.c @LIBEXPAT_INTERNAL@ MODULE__HASHLIB_DEPS=$(srcdir)/Modules/hashlib.h MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h MODULE__MD5_DEPS=$(srcdir)/Modules/hashlib.h diff --git a/Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst b/Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst new file mode 100644 index 00000000000000..334d90cef6f042 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst @@ -0,0 +1,4 @@ +Don't let ``--with-system-libmpdec`` or ``--with-system-expat`` use the +vendored headers of libmpdec or expact. When the ``--with-system-...`` flag +is passed to ``./configure``, the ``Modules/_decimal/libmpdec`` or +``Modules/expat`` directory can be safely removed before building Python. diff --git a/configure b/configure index 953c558d6048d4..6bcb2115490053 100755 --- a/configure +++ b/configure @@ -12619,7 +12619,7 @@ else LIBEXPAT_CFLAGS="-I\$(srcdir)/Modules/expat" LIBEXPAT_LDFLAGS="-lm \$(LIBEXPAT_A)" - LIBEXPAT_INTERNAL="\$(LIBEXPAT_A)" + LIBEXPAT_INTERNAL="\$(LIBEXPAT_HEADERS) \$(LIBEXPAT_A)" fi @@ -13128,7 +13128,7 @@ else LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)" - LIBMPDEC_INTERNAL="\$(LIBMPDEC_A)" + LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" if test "x$with_pydebug" = xyes; then : diff --git a/configure.ac b/configure.ac index 210ce3292cfdf7..7cdb39a42121f2 100644 --- a/configure.ac +++ b/configure.ac @@ -3710,7 +3710,7 @@ AS_VAR_IF([with_system_expat], [yes], [ ], [ LIBEXPAT_CFLAGS="-I\$(srcdir)/Modules/expat" LIBEXPAT_LDFLAGS="-lm \$(LIBEXPAT_A)" - LIBEXPAT_INTERNAL="\$(LIBEXPAT_A)" + LIBEXPAT_INTERNAL="\$(LIBEXPAT_HEADERS) \$(LIBEXPAT_A)" ]) AC_SUBST([LIBEXPAT_CFLAGS]) @@ -3819,7 +3819,7 @@ AS_VAR_IF([with_system_libmpdec], [yes], [ ], [ LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec" LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)" - LIBMPDEC_INTERNAL="\$(LIBMPDEC_A)" + LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)" dnl Disable forced inlining in debug builds, see GH-94847 AS_VAR_IF([with_pydebug], [yes], [ From cb7d84078bec2fc9395d3edf97b688b737d850ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 26 Oct 2022 23:26:28 +0200 Subject: [PATCH 2/2] Better changelog entry Co-authored-by: Erlend E. Aasland --- .../Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst b/Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst index 334d90cef6f042..69afa9dea30702 100644 --- a/Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst +++ b/Misc/NEWS.d/next/Build/2022-10-26-12-37-52.gh-issue-98707.eVXGEx.rst @@ -1,4 +1,4 @@ -Don't let ``--with-system-libmpdec`` or ``--with-system-expat`` use the -vendored headers of libmpdec or expact. When the ``--with-system-...`` flag -is passed to ``./configure``, the ``Modules/_decimal/libmpdec`` or -``Modules/expat`` directory can be safely removed before building Python. +Don't use vendored ``libmpdec`` headers if :option:`--with-system-libmpdec` +is passed to :program:`configure`. +Don't use vendored ``libexpat`` headers if :option:`--with-system-expat` +is passed to :program:`!configure`.