GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python.h setting HAVE_THREAD_LOCAL breaks numpy build · Issue #142163 · python/cpython

python.h setting HAVE_THREAD_LOCAL breaks numpy build #142163

New issue
Copy link
New issue
Copy link
Closed
Closed
python.h setting HAVE_THREAD_LOCAL breaks numpy build#142163
Copy link
Assignees
ZeroIntensity
Labels
3.15bugs and security fixesbugs and security fixesbuildThe build process and cross-buildThe build process and cross-buildinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@ngoldbaum
ngoldbaum
opened on Dec 1, 2025
Issue body actions

Currently NumPy will fail to build on some systems using CPython main with the following error:

 FAILED: [code=1] numpy/_core/_multiarray_umath.cpython-315-darwin.so.p/meson-generated_scalartypes.c.o
  cc -Inumpy/_core/_multiarray_umath.cpython-315-darwin.so.p -Inumpy/_core -I../numpy/_core -Inumpy/_core/include -I../numpy/_core/include -I../numpy/_core/src/common -I../numpy/_core/src/multiarray -I../numpy/_core/src/npymath -I../numpy/_core/src/umath -I../numpy/_core/src/highway -I/Users/goldbaum/.pyenv/versions/3.15-dev/include/python3.15 -I/Users/goldbaum/Documents/numpy/.mesonpy-9trjlyib/meson_cpu -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c11 -O3 -fno-strict-aliasing -ftrapping-math -DNPY_HAVE_CLANG_FPSTRICT -DNPY_HAVE_NEON_VFPV4 -DNPY_HAVE_NEON_FP16 -DNPY_HAVE_NEON -DNPY_HAVE_ASIMD -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework -idirafter/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Headers -DACCELERATE_NEW_LAPACK -DHAVE_CBLAS '-DBLAS_SYMBOL_SUFFIX=$NEWLAPACK' -DNPY_INTERNAL_BUILD -DHAVE_NPY_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -MD -MQ numpy/_core/_multiarray_umath.cpython-315-darwin.so.p/meson-generated_scalartypes.c.o -MF numpy/_core/_multiarray_umath.cpython-315-darwin.so.p/meson-generated_scalartypes.c.o.d -o numpy/_core/_multiarray_umath.cpython-315-darwin.so.p/meson-generated_scalartypes.c.o -c numpy/_core/_multiarray_umath.cpython-315-darwin.so.p/scalartypes.c
  In file included from ../numpy/_core/src/multiarray/scalartypes.c.src:28:
  ../numpy/_core/src/multiarray/conversion_utils.h:116:22: error: unknown type name 'thread_local'
    116 | extern NPY_NO_EXPORT NPY_TLS int evil_global_disable_warn_O4O8_flag;
        |                      ^
  ../numpy/_core/include/numpy/npy_common.h:131:21: note: expanded from macro 'NPY_TLS'
    131 |     #define NPY_TLS thread_local
        |                     ^
  1 error generated.

You can see why that's happening by looking at npy_common.h and noting that it depends on HAVE_THREAD_LOCAL being set by NumPy's meson build configuration based on a configure-time check:

https://github.com/numpy/numpy/blob/fb0578d3973e926eee2e68ce9fd9996459b8534b/numpy/_core/include/numpy/npy_common.h#L128-L140

https://github.com/numpy/numpy/blob/fb0578d3973e926eee2e68ce9fd9996459b8534b/numpy/_core/meson.build#L269-L294

Since #140690 was merged, python.h now unconditionally sets HAVE_THREAD_LOCAL, breaking the logic in npy_common.h.

Maybe on the NumPy side we should be prepending macros that depend on configure-time checks with a NPY_ prefix to avoid issues like this but also numpy might not be the only library where HAVE_THREAD_LOCAL is load-bearing. I don't see anything besides Python and NumPy in a github search: https://github.com/search?q=HAVE_THREAD_LOCAL+language%3AC+python.h&type=code&p=2

cc @ZeroIntensity. Also h/t to @tacaswell for originally finding this, reporting it on Discord, and bisecting it.

Linked PRs

  • gh-142163: Only define HAVE_THREAD_LOCAL when Py_BUILD_CORE is set #142164
Reacted by Louis Maddox

Activity

  1. picnixz
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    buildThe build process and cross-buildThe build process and cross-build
    3.15bugs and security fixesbugs and security fixes
    on Dec 1, 2025
  2. ZeroIntensity
    self-assigned this
    on Dec 1, 2025
  3. kumaraditya303
    added a commit that references this issue on Dec 2, 2025

    gh-142163: Only define `HAVE_THREAD_LOCAL` when `Py_BUILD_CORE` is set (

    4172885
  4. kumaraditya303
    closed this as completedon Dec 2, 2025
  5. StanFromIreland
    added a commit that references this issue on Dec 6, 2025

    pythongh-142163: Only define `HAVE_THREAD_LOCAL` when `Py_BUILD_CORE`…

    d216ed1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ZeroIntensity
    ZeroIntensity

Labels

3.15bugs and security fixesbugs and security fixesbuildThe build process and cross-buildThe build process and cross-buildinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.