Opened 5 months ago
Last modified 7 weeks ago
#73282 assigned defect
python314 +universal doesn't know it's a universal binary
| Reported by: | bgilbert (Benjamin Gilbert) | Owned by: | jmroot (Joshua Root) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | Cc: | ||
| Port: | python314 |
Description
Installing python314 +universal installs a universal binary, but sysconfig.get_platform() doesn't mention -universal2 as expected.
$ file /opt/local/bin/python3.14
/opt/local/bin/python3.14: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
/opt/local/bin/python3.14 (for architecture x86_64): Mach-O 64-bit executable x86_64
/opt/local/bin/python3.14 (for architecture arm64): Mach-O 64-bit executable arm64
$ /opt/local/bin/python3.14
Python 3.14.0 (main, Oct 14 2025, 02:07:44) [Clang 17.0.0 (clang-1700.4.4.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_config_var('CONFIG_ARGS')
"'--prefix=/opt/local' '--disable-dependency-tracking' '--enable-framework=/opt/local/Library/Frameworks' '--enable-ipv6' '--enable-loadable-sqlite-extensions' '--with-computed-gotos' '--with-ensurepip=no' '--with-readline=editline' '--with-system-expat' '--with-dbmliborder=ndbm:bdb' '--enable-universalsdk=/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk' '--enable-optimizations' '--with-lto' 'CC=/usr/bin/clang' 'CFLAGS=-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk ' 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk ' 'CPPFLAGS=-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk'"
>>> sysconfig.get_platform()
'macosx-26.0-arm64'
>>>
Change History (2)
comment:1 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)
| Owner: | set to jmroot |
|---|---|
| Status: | new → assigned |
comment:2 Changed 7 weeks ago by petrmanek (Petr Mánek)
I just tried to build python314 +universal on macOS 15 (darwin 24, arm64+x86_64) and may have some relevant information.
I found that the variant universal block doesn't pass --with-universal-archs=universal2. Configure stage defaults to --with-universal-archs=intel, causing HACL* SIMD256 (AVX2) intrinsics to be compiled for arm64, which fails.
Error:
error: always_inline function '_mm256_set1_epi32' requires target feature 'avx2', but would be inlined into function 'Hacl_Hash_SHA2_sha256_8' that is compiled without support for 'avx2'
Fix (add inside variant universal block within Portfile):
configure.args-append --enable-universalsdk=${configure.sysroot}
+ # Fix HACL* SIMD256 build failure: without this, configure defaults to
+ # --with-universal-archs=intel which compiles AVX2 intrinsics for arm64.
+ if {"arm64" in ${configure.universal_archs} && "x86_64" in ${configure.universal_archs}} {
+ configure.args-append --with-universal-archs=universal2
+ }
I verified this does the trick by locally patching python314's Portfile and re-building it. Note that this should also fix the sysconfig.get_platform() issue reported above (same root cause).

Presumably you are contrasting that output with what you get from the system's python, which on my Monterey system is:
Is there a reason why you need
sysconfig.get_platform()'s output to include-universal2? How would that be helpful to you?Is there documentation stating that
sysconfig.get_platform()shall include-universal2when python is built universal?