Files
nixpkgs/pkgs/development/python-modules/cuda-tile/xla_ffi-include-python-first.patch
Andrew Marshall e1fd73e425 python3Packages.cuda-tile: fix build with newer glibc
See comment in patch for details.

Assisted-by: Deepseek V4.1 Flash (Pi)
2026-10-08 15:45:48 -04:00

22 lines
631 B
Diff

Include Python.h before any glibc header in xla_ffi.cpp
g++ defines _GNU_SOURCE, so glibc 2.44's features.h now defines
_POSIX_C_SOURCE/_XOPEN_SOURCE. xla_ffi.cpp includes c_api.h (-> stdint.h ->
features.h) before py.h/Python.h, so Python's pyconfig.h then redefines
those macros, which the project's -Werror turns into a build failure.
Include Python.h first so pyconfig.h sets the macros before features.h,
which #undefs before redefining them.
--- a/cext/xla_ffi.cpp
+++ b/cext/xla_ffi.cpp
@@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: Apache-2.0
+#include <Python.h>
+
#ifdef _WIN32
#include "xla/ffi/api/c_api.h"