gh-143120: pixi builds for free-threading and TSAN by crusaderky · Pull Request #142872 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d930e12
pixi builds for free-threading and tsan
crusaderky Dec 17, 2025
57d45b9
Rename to tsan-free-threading
crusaderky Jan 2, 2026
5ff29b4
Add libclang_rt hack
crusaderky Jan 2, 2026
9a2a896
Add troubleshooting for tsan
crusaderky Jan 2, 2026
97979e0
Add python_abi output and refactor
isuruf Jan 8, 2026
456503b
fix typo
isuruf Jan 8, 2026
c46f283
Use single recipe.yaml duplicated across directories
isuruf Jan 9, 2026
d1a38c1
use symlinks
isuruf Jan 9, 2026
57715f5
remove generate.sh
isuruf Jan 9, 2026
8243c20
Merge remote-tracking branch 'origin/main' into tsan
crusaderky Jan 12, 2026
12da3b8
Fix
crusaderky Jan 14, 2026
bfa4da3
Merge remote-tracking branch 'upstream/main' into tsan
crusaderky Jan 14, 2026
1a4106f
Fix tsan
crusaderky Jan 14, 2026
2402f77
switch ABI tag for asan/tsan
crusaderky Jan 14, 2026
56f4403
git cleanup 1/2
crusaderky Jan 14, 2026
546dcc0
git cleanup 2/2
crusaderky Jan 14, 2026
cd4cd26
README
crusaderky Jan 15, 2026
f028ded
Merge remote-tracking branch 'upstream/main' into tsan
crusaderky Jan 15, 2026
a86d345
Use libcompiler-rt and remove hack
isuruf Jan 19, 2026
0aa5872
use at least macos 10.12
isuruf Jan 20, 2026
62b7d1c
Merge remote-tracking branch 'upstream/main' into tsan
crusaderky Jan 21, 2026
ad6c740
Use libcompiler-rt and remove hack
isuruf Jan 19, 2026
fd6ca6d
note
crusaderky Jan 21, 2026
abae5a5
Fix CPPFLAGS too
isuruf Jan 21, 2026
a3f59cc
Merge remote-tracking branch 'upstream/main' into tsan
crusaderky Jan 22, 2026
fd87e84
Merge remote-tracking branch 'upstream/main' into tsan
crusaderky Jan 22, 2026
2649286
Update Tools/pixi-packages/README.md
crusaderky Jan 22, 2026
0e98a4a
Update platforms
crusaderky Jan 22, 2026
4f49228
Merge remote-tracking branch 'isuruf/libcompiler-rt' into tsan
crusaderky Jan 22, 2026
7b8f9d3
Merge branch 'main' into tsan
crusaderky Jan 22, 2026
1ae77a5
Revert "Use libcompiler-rt and remove hack"
crusaderky Jan 22, 2026
cddc933
Revert "Update Tools/pixi-packages/README.md"
crusaderky Jan 22, 2026
43eead1
Reapply "Update Tools/pixi-packages/README.md"
crusaderky Jan 23, 2026
55242c3
Reapply "Use libcompiler-rt and remove hack"
crusaderky Jan 23, 2026
2f5daba
There is no c_compiler variable
crusaderky Jan 23, 2026
fdacca7
Don't use system-wide libasan on Linux
crusaderky Jan 23, 2026
2d4472f
Merge remote-tracking branch 'upstream/main' into tsan
crusaderky Jan 23, 2026
defe6a6
Don't use symlinks 1/2
crusaderky Jan 23, 2026
e33bc48
Don't use symlinks 2/2
crusaderky Jan 23, 2026
325dc99
Merge branch 'main' into tsan
kumaraditya303 Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions Tools/pixi-packages/README.md
5 changes: 4 additions & 1 deletion Tools/pixi-packages/asan/pixi.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# NOTE: Please always only modify default/pixi.toml and then run clone-recipe.sh to
# propagate the changes to the other variants.

[workspace]
channels = ["https://prefix.dev/conda-forge"]
platforms = ["osx-arm64", "linux-64"]
platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64"]
preview = ["pixi-build"]

[package.build.backend]
Expand Down
129 changes: 80 additions & 49 deletions Tools/pixi-packages/asan/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,92 @@
# NOTE: Please always only modify default/recipe.yaml and then run clone-recipe.sh to
# propagate the changes to the other variants.

context:
# Keep up to date
version: "3.15"
freethreading_tag: ${{ "t" if "freethreading" in variant else "" }}

package:
recipe:
name: python
version: ${{ version }}

source:
- path: ../../..

build:
files:
exclude:
- "*.o"
script:
file: ../build.sh
env:
PYTHON_VARIANT: "asan"

# derived from https://github.com/conda-forge/python-feedstock/blob/main/recipe/meta.yaml
requirements:
outputs:
- package:
name: python_abi
version: ${{ version }}
build:
string: "0_${{ abi_tag }}"
requirements:
run_constraints:
- python ${{ version }}.* *_${{ abi_tag }}

- package:
name: python
version: ${{ version }}
build:
- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
- make
- pkg-config
# configure script looks for llvm-ar for lto
- if: osx
then:
- llvm-tools
- if: linux
then:
- ld_impl_${{ target_platform }}
- binutils_impl_${{ target_platform }}
- clang-19
- llvm-tools-19

host:
- bzip2
- sqlite
- liblzma-devel
- zlib
- zstd
- openssl
- readline
- tk
# These two are just to get the headers needed for tk.h, but is unused
- xorg-libx11
- xorg-xorgproto
- ncurses
- libffi
- if: linux
then:
- ld_impl_${{ target_platform }}
- libuuid
- libmpdec-devel
- expat
string: "0_${{ abi_tag }}"
files:
exclude:
- "*.o"
script:
file: ../build.sh
env:
PYTHON_VARIANT: ${{ variant }}
python:
site_packages_path: "lib/python${{ version }}${{ freethreading_tag }}/site-packages"

# derived from https://github.com/conda-forge/python-feedstock/blob/main/recipe/meta.yaml
requirements:
build:
- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
# Note that we are not using stdlib arguments which means the packages
# are built for the build settings and are not relocatable to a different
# machine that has a older system version. (eg: macOS/glibc version)
- make
- pkg-config
# configure script looks for llvm-ar for lto
- if: osx
then:
- llvm-tools

host:
- bzip2
- sqlite
- liblzma-devel
- zlib
- zstd
- openssl
- readline
- tk
# These two are just to get the headers needed for tk.h, but is unused
- xorg-libx11
- xorg-xorgproto
- ncurses
- libffi
- if: linux
then:
- libuuid
- libmpdec-devel
- expat
- if: linux and "san" in variant
then:
- libsanitizer
- if: osx and "san" in variant
then:
- libcompiler-rt

ignore_run_exports:
from_package:
- xorg-libx11
- xorg-xorgproto

run_exports:
noarch:
- python
weak:
- python_abi ${{ version }}.* *_${{ abi_tag }}

about:
homepage: https://www.python.org/
Expand Down
6 changes: 6 additions & 0 deletions Tools/pixi-packages/asan/variants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
variant:
- asan
abi_tag:
- asan_cp315
version:
- 3.15
39 changes: 27 additions & 12 deletions Tools/pixi-packages/build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
#!/bin/bash

if [[ "${PYTHON_VARIANT}" == "asan" ]]; then
echo "BUILD TYPE: ASAN"
BUILD_DIR="../build_asan"
echo "PYTHON_VARIANT: ${PYTHON_VARIANT}"

if [[ "${PYTHON_VARIANT}" == "freethreading" ]]; then
CONFIGURE_EXTRA="--disable-gil"
elif [[ "${PYTHON_VARIANT}" == "asan" ]]; then
CONFIGURE_EXTRA="--with-address-sanitizer"
export PYTHON_ASAN="1"
Comment thread
crusaderky marked this conversation as resolved.
export ASAN_OPTIONS="strict_init_order=true"
else
echo "BUILD TYPE: DEFAULT"
BUILD_DIR="../build"
elif [[ "${PYTHON_VARIANT}" == "tsan-freethreading" ]]; then
CONFIGURE_EXTRA="--disable-gil --with-thread-sanitizer"
export TSAN_OPTIONS="suppressions=${SRC_DIR}/Tools/tsan/suppressions_free_threading.txt"
elif [[ "${PYTHON_VARIANT}" == "default" ]]; then
CONFIGURE_EXTRA=""
else
echo "Unknown PYTHON_VARIANT: ${PYTHON_VARIANT}"
exit 1
fi

# rattler-build by default set a target of 10.9
# override it to at least 10.12
case ${MACOSX_DEPLOYMENT_TARGET:-10.12} in
10.12|10.13|10.14|10.15|10.16)
;;
10.*)
export CPPFLAGS=${CPPFLAGS/-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}/-mmacosx-version-min=10.12}
export MACOSX_DEPLOYMENT_TARGET=10.12
;;
*)
;;
esac

BUILD_DIR="../build_${PYTHON_VARIANT}"
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"

Expand All @@ -23,15 +42,11 @@ else
--oldincludedir="${BUILD_PREFIX}/${HOST}/sysroot/usr/include" \
--enable-shared \
--srcdir="${SRC_DIR}" \
--with-system-expat \
Comment thread
crusaderky marked this conversation as resolved.
${CONFIGURE_EXTRA}
fi

touch configure-done

make -j"${CPU_COUNT}" install
ln -sf "${PREFIX}/bin/python3" "${PREFIX}/bin/python"

# https://github.com/prefix-dev/rattler-build/issues/2012
if [[ ${OSTYPE} == "darwin"* ]]; then
cp "${BUILD_PREFIX}/lib/clang/21/lib/darwin/libclang_rt.asan_osx_dynamic.dylib" "${PREFIX}/lib/libclang_rt.asan_osx_dynamic.dylib"
fi
10 changes: 10 additions & 0 deletions Tools/pixi-packages/clone-recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Please always only modify default/recipe.yaml and default/pixi.toml and then run this
# script to propagate the changes to the other variants.
set -o errexit
cd "$(dirname "$0")"

for variant in asan freethreading tsan-freethreading; do
cp -av default/recipe.yaml default/pixi.toml ${variant}/
done
5 changes: 4 additions & 1 deletion Tools/pixi-packages/default/pixi.toml
Loading
Loading