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 — Build Failure in posixmodule.c with Clang, ThreadSanitizer, and free-threaded build enabled · Issue #140159 · python/cpython

Build Failure in posixmodule.c with Clang, ThreadSanitizer, and free-threaded build enabled #140159

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
Build Failure in posixmodule.c with Clang, ThreadSanitizer, and free-threaded build enabled#140159
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@ashm-dev
ashm-dev
opened on Oct 15, 2025
Issue body actions

Description:

A build failure occurs in Modules/posixmodule.c when compiling CPython from the main branch using Clang with ThreadSanitizer and the --disable-gil flag.

The compilation fails with two distinct types of errors:

  1. The compiler reports that the statx struct has no member named stx_atomic_write_unit_max_opt. This error originates from the MM macro expansion within the pystatx_result_members definition.
  2. Subsequently, multiple errors are reported for an invalid application of sizeof to an incomplete type PyMemberDef[]. This happens when the Py_ARRAY_LENGTH macro is used on pystatx_result_members, indicating that the array's definition was not completed due to the initial error.

This suggests that the feature detection or conditional compilation logic for the stx_atomic_write_unit_max_opt member is not functioning correctly under this specific build configuration.

Steps to Reproduce:

  1. Check out the main branch of cpython.
  2. Configure the build with the following command:
    CC=clang CXX=clang++ ./configure --with-thread-sanitizer --with-pydebug --disable-gil
  3. Run the build:
    make

Expected Behavior:
The build process should complete successfully.

Actual Behavior:
The build fails with the following errors logged from Modules/posixmodule.c:

../Modules/posixmodule.c:3369:5: error: no member named 'stx_atomic_write_unit_max_opt' in 'statx'
3369 |     MM(stx_atomic_write_unit_max_opt, Py_T_UINT, atomic_write_unit_max_opt,
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3370 |         "maximum optimized size for direct I/O with torn-write protection"),
|         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/posixmodule.c:3325:20: note: expanded from macro 'MM'
3325 |     M(#attr, type, offsetof(Py_statx_result, stx.stx_##member), doc)
|     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/llvm-20/lib/clang/20/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
16 | #define offsetof(t, d) __builtin_offsetof(t, d)
|                        ^
./Modules/posixmodule.c:3323:18: note: expanded from macro 'M'
3323 |     {attr, type, offset, Py_READONLY, PyDoc_STR(doc)}
|                  ^~~~~~
./Modules/posixmodule.c:3427:28: error: invalid application of 'sizeof' to an incomplete type 'PyMemberDef[]' (aka 'struct PyMemberDef[]')
3427 |     for (size_t i = 0; i < Py_ARRAY_LENGTH(pystatx_result_members) - 1; ++i) {
|                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymacro.h:190:12: note: expanded from macro 'Py_ARRAY_LENGTH'
190 |     (sizeof(array) / sizeof((array)[0]))
|            ^~~~~~~
./Modules/posixmodule.c:3447:9: error: invalid application of 'sizeof' to an incomplete type 'PyMemberDef[]' (aka 'struct PyMemberDef[]')
3447 |     if (Py_ARRAY_LENGTH(pystatx_result_members) > 1
|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Include/pymacro.h:190:12: note: expanded from macro 'Py_ARRAY_LENGTH'
190 |     (sizeof(array) / sizeof((array)[0]))
|            ^~~~~~~

Environment:

  • Compiler: Clang
  • Configuration Flags: --with-thread-sanitizer --with-pydebug --disable-gil

Activity

  1. ashm-dev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Oct 15, 2025
  2. ashm-dev
    changed the title [-]Build Failure: `posixmodule.c` fails to compile with clang due to missing `stx_atomic_write_unit_max_opt` and subsequent `sizeof` error on incomplete type.[/-] [+]Build Failure in posixmodule.c with Clang, ThreadSanitizer, and free-threaded build enabled[/+] on Oct 15, 2025
  3. StanFromIreland
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Oct 15, 2025
  4. colesbury commented on Oct 15, 2025

    @colesbury
    colesbury
    on Oct 15, 2025
    Contributor
    More actions

    Likely related to:

    • gh-83714: Disable os.statx_result.stx_atomic_write_unit_max_opt #140162
    • Add os.statx() function #83714
  5. ashm-dev commented on Oct 15, 2025

    @ashm-dev
    ashm-dev
    on Oct 15, 2025
    ContributorAuthor
    More actions

    @colesbury Yes, you're right, after that PR broke the build.

  6. colesbury commented on Oct 15, 2025

    @colesbury
    colesbury
    on Oct 15, 2025
    Contributor
    More actions

    Ok, going to mark this as a duplicate as there is a PR out from @vstinner to fix this

    Reacted by Victor Stinner and Shamil
  7. colesbury
    closed this as a duplicateof Add os.statx() function #83714 on Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirC modules in the Modules dirtype-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.