diff options
author | Christian Heimes <christian@python.org> | 2022-06-29 14:22:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 14:22:41 (GMT) |
commit | a548a456330f9a9d99a0bd4e11e6e0862da81989 (patch) | |
tree | 6124f5156e30cc42f9125503e03450e0070c97f8 | |
parent | 9140c413d03080f12066b6f7f23f8c92543b5ded (diff) | |
download | cpython-a548a456330f9a9d99a0bd4e11e6e0862da81989.zip cpython-a548a456330f9a9d99a0bd4e11e6e0862da81989.tar.gz cpython-a548a456330f9a9d99a0bd4e11e6e0862da81989.tar.bz2 |
[3.11] gh-94404: Use module CFLAGS before PY_STDMODULE_CFLAGS (GH-94413) (GH-94415)
``PY_STDMODULE_CFLAGS`` may contain include directories with system
headers. This can break compiling with built-in libmpdec.
Co-authored-by: Christian Heimes <christian@python.org>
-rw-r--r-- | Makefile.pre.in | 4 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst | 3 | ||||
-rwxr-xr-x | Modules/makesetup | 7 |
3 files changed, 8 insertions, 6 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in index 004ab3a..3d0e279 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -831,7 +831,7 @@ python.worker.js: $(srcdir)/Tools/wasm/python.worker.js ########################################################################## # Build static libmpdec.a -LIBMPDEC_CFLAGS=$(PY_STDMODULE_CFLAGS) $(CCSHARED) @LIBMPDEC_CFLAGS@ +LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED) # for setup.py DECIMAL_CFLAGS=@LIBMPDEC_CFLAGS@ @@ -889,7 +889,7 @@ $(LIBMPDEC_A): $(LIBMPDEC_OBJS) ########################################################################## # Build static libexpat.a -LIBEXPAT_CFLAGS=$(PY_STDMODULE_CFLAGS) $(CCSHARED) @LIBEXPAT_CFLAGS@ +LIBEXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED) # for setup.py EXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ diff --git a/Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst b/Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst index 519a5ce..c7c4753 100644 --- a/Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst +++ b/Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst @@ -1,2 +1,3 @@ ``makesetup`` now works around an issue with sed on macOS and uses correct -CFLAGS for object files that end up in a shared extension. +CFLAGS for object files that end up in a shared extension. Module CFLAGS +are used before PY_STDMODULE_CFLAGS to avoid clashes with system headers. diff --git a/Modules/makesetup b/Modules/makesetup index a45b7de..0830381 100755 --- a/Modules/makesetup +++ b/Modules/makesetup @@ -260,13 +260,14 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | \$*) ;; *) src='$(srcdir)/'"$srcdir/$src";; esac + # custom flags first, PY_STDMODULE_CFLAGS may contain -I with system libmpdec case $doconfig in - no) cc="$cc \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)";; + no) cc="$cc $cpps \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)";; *) - cc="$cc \$(PY_BUILTIN_MODULE_CFLAGS)";; + cc="$cc $cpps \$(PY_BUILTIN_MODULE_CFLAGS)";; esac # force rebuild when header file or module build flavor (static/shared) is changed - rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS) Modules/config.c; $cc $cpps -c $src -o $obj" + rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS) Modules/config.c; $cc -c $src -o $obj" echo "$rule" >>$rulesf done case $doconfig in |