This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: makesetup Doesn't Handle Defines with Equal Sign
Type: compile error Stage:
Components: Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: AstraLuma, John Muth, wbond
Priority: normal Keywords:

Created on 2019-08-13 11:00 by wbond, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg349543 - (view) Author: Will Bond (wbond) Date: 2019-08-13 11:00
Using 3.8.0b3 on macOS. I'm doing a custom compile with (heavy) modifications to Modules/Setup.local. Whenever I add a define rule to a module line that includes an equal sign, e.g.:

_sqlite3 -DMODULE_NAME=_sqlite3 _sqlite/module.c _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -I../env/include -I\$(srcdir)/Modules/_sqlite ../env/lib/libsqlite3.a

makesetup appears to treat this as a Makefile variable definition, which places the rule in the wrong part of the Makefile. In my situation, this causes _sqlite3 to be compiled as a shared library instead of statically.

I see this was peripherally reported at, but in that case the =1 was just dropped rather than solving the underlying issue. For many situations, dropping the =1 works, but in others it is not.

Not that this is necessarily helpful, but I do know that this used to work with Python 3.3.
msg354852 - (view) Author: John Muth (John Muth) Date: 2019-10-17 18:32
I ran into the same issue. This patch fixed it for me.

diff --git a/Modules/makesetup b/Modules/makesetup
index eac97ad134..0fbac03833 100755
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -133,6 +133,7 @@ sed -e 's/[         ]*#.*//' -e '/^[        ]*$/d' |
                # Output DEFS in reverse order so first definition overrides
                case $line in
+               *-D*) ;;
                *=*)    DEFS="$line$NL$DEFS"; continue;;
                'include '*)    DEFS="$line$NL$DEFS"; continue;;
msg355682 - (view) Author: Jamie Bliss (AstraLuma) Date: 2019-10-29 21:40
Similarly, stumbled across this working on

This is particularly problematic because of the SQLite module's MODULE_NAME macro.
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82020
2019-10-29 21:40:45AstraLumasetnosy: + AstraLuma
messages: + msg355682
2019-10-17 18:32:23John Muthsetnosy: + John Muth
messages: + msg354852
2019-08-13 11:00:09wbondcreate