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: execute shell command ./configure with python subprocess.popen, os.system ... checking build system type... is wrong
Type: behavior Stage: resolved
Components: macOS Versions: Python 3.11
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: JunyiXie, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2021-11-12 09:08 by JunyiXie, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (6)
msg406194 - (view) Author: junyixie (JunyiXie) * Date: 2021-11-12 09:08
checking build system type... x86_64-apple-darwin20.5.0
checking host system type... x86_64-apple-darwin20.5.0

checking build system type... arm-apple-darwin20.5.0
checking host system type... arm-apple-darwin20.5.0
msg406195 - (view) Author: junyixie (JunyiXie) * Date: 2021-11-12 09:09
subprocess.Popen([], executable=os.path.join(cpython_dir, "configure"), cwd=cpython_dir).wait()
msg406196 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-11-12 09:38
I'm assuming you run on a M1* system. 

What's the architecture for the python binary (run "file $(which python3)" in a shell to get this information, excluding the quotes)?

If the binary supports only x86_64 you might run into a "feature" of macOS: subprocesses started from a Rosetta 2 process also prefer to run in emulation.

This can also be demonstrated using the system install of perl, for example:

% perl -e 'print `arch`'

% arch -x86_64 perl -e 'print `arch`'

There sadly doesn't appear to be documentation about this on Apple's site.

Note that the universal2 variants of the installers on natively support both x86_64 and arm64.
msg406197 - (view) Author: junyixie (JunyiXie) * Date: 2021-11-12 09:39
when run pyperformance compile in apple silicon also have this problem
msg406198 - (view) Author: junyixie (JunyiXie) * Date: 2021-11-12 09:41
> What's the architecture for the python binary (run "file $(which python3)" in a shell to get this information, excluding the quotes)?
yeah, is x86_64 python executable
.../opt/anaconda3/bin/python3: Mach-O 64-bit executable x86_64
msg406203 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-11-12 10:31
The problem will go away when you install and use an arm64 or universal2 variant of Python.

This is behaviour of macOS and cannot be changed in CPython.
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89951
2021-11-12 10:31:03ronaldoussorensetstatus: open -> closed
resolution: third party
messages: + msg406203

stage: resolved
2021-11-12 09:41:02JunyiXiesetmessages: + msg406198
2021-11-12 09:39:23JunyiXiesetmessages: + msg406197
2021-11-12 09:38:46ronaldoussorensetmessages: + msg406196
2021-11-12 09:09:03JunyiXiesetmessages: + msg406195
2021-11-12 09:08:28JunyiXiecreate