From c2b0cc9540464e45cfec99f5526021780d3faf93 Mon Sep 17 00:00:00 2001 From: mario4tier Date: Thu, 26 Nov 2026 21:48:51 -0500 Subject: [PATCH] .github: build the Linux extension with Python's compile flags The Linux jobs exported CFLAGS=-D_GNU_SOURCE. setuptools uses an environment CFLAGS in place of the interpreter's own, so the Cython extension was compiled without -O3 and -DNDEBUG. The TA-Lib C library inside the wheel was not affected: CMake builds it Release. Remove the setting. It was added for the 0.7.1 build of the C library's tools, which setup.py no longer builds, and Python.h defines _GNU_SOURCE for the extension itself. Python's flags include -g, so strip the repaired wheels to keep their size. --- .github/workflows/wheels.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index ff618037c..dbc1873d7 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -11,6 +11,9 @@ env: PIP_VERBOSE: 1 CIBW_BEFORE_BUILD: pip install -U setuptools Cython wheel meson-python ninja && pip install -U numpy CIBW_SKIP: "pp* cp39-* cp313t*" + # No CFLAGS in a job's environment: setuptools would use it in place of Python's own compile + # flags, -O3 included. Those flags carry -g, which --strip removes from the Linux wheels. + CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --strip -w {dest_dir} {wheel}" jobs: build_linux_x86_64: @@ -27,8 +30,6 @@ jobs: env: CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2 - CIBW_ENVIRONMENT_PASS_LINUX: CFLAGS - CFLAGS: -D_GNU_SOURCE CIBW_TEST_SKIP: "cp*-musllinux*" CIBW_TEST_COMMAND: > cd .. && @@ -56,8 +57,6 @@ jobs: env: CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2 - CIBW_ENVIRONMENT_PASS_LINUX: CFLAGS - CFLAGS: -D_GNU_SOURCE CIBW_TEST_SKIP: "cp*-musllinux*" CIBW_TEST_COMMAND: > cd .. &&