Skip to content

Commit eb0149f

Browse files
committed
WIP pixi builds for free-threading and tsan
1 parent 248eb3e commit eb0149f

File tree

6 files changed

+157
-5
lines changed

6 files changed

+157
-5
lines changed

Tools/pixi-packages/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ python = { git = "https://github.com/python/cpython", subdirectory = "Tools/pixi
1212
```
1313

1414
This is particularly useful when developers need to build CPython from source
15-
(for example, for an ASan-instrumented build), as it does not require any manual
15+
(for example, for an ASan or TSan-instrumented build), as it does not require any manual
1616
clone or build steps. Instead, Pixi will automatically handle both the build
1717
and installation of the package.
1818

1919
Each package definition is contained in a subdirectory, but they share the build script
2020
`build.sh` in this directory. Currently defined package variants:
2121

2222
- `default`
23-
- `asan`: ASan-instrumented build with `PYTHON_ASAN=1`
23+
- `free-threading`
24+
- `asan`: ASan-instrumented build
25+
- `tsan`: free-threading, TSan-instrumented build
2426

2527
## Maintenance
2628

@@ -30,7 +32,7 @@ Each package definition is contained in a subdirectory, but they share the build
3032

3133
## Opportunities for future improvement
3234

33-
- More package variants (such as TSan, UBSan)
35+
- More package variants (such as UBSan)
3436
- Support for Windows
3537
- Using a single `pixi.toml` and `recipe.yaml` for all package variants is blocked on https://github.com/prefix-dev/pixi/issues/4599
3638
- A workaround can be removed from the build script once https://github.com/prefix-dev/rattler-build/issues/2012 is resolved

Tools/pixi-packages/build.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#!/bin/bash
22

3-
if [[ "${PYTHON_VARIANT}" == "asan" ]]; then
3+
if [[ "${PYTHON_VARIANT}" == "free-threading" ]]; then
4+
echo "BUILD TYPE: FREE-THREADING"
5+
BUILD_DIR="../build_free_threading"
6+
CONFIGURE_EXTRA="--disable-gil"
7+
elif [[ "${PYTHON_VARIANT}" == "asan" ]]; then
48
echo "BUILD TYPE: ASAN"
59
BUILD_DIR="../build_asan"
610
CONFIGURE_EXTRA="--with-address-sanitizer"
7-
export PYTHON_ASAN="1"
811
export ASAN_OPTIONS="strict_init_order=true"
12+
elif [[ "${PYTHON_VARIANT}" == "tsan" ]]; then
13+
echo "BUILD TYPE: TSAN"
14+
BUILD_DIR="../build_tsan"
15+
CONFIGURE_EXTRA="--disable-gil --with-thread-sanitizer"
16+
export TSAN_OPTIONS="suppressions=${SRC_DIR}/Tools/tsan/suppressions_free_threading.txt"
917
else
1018
echo "BUILD TYPE: DEFAULT"
1119
BUILD_DIR="../build"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
platforms = ["osx-arm64", "linux-64"]
4+
preview = ["pixi-build"]
5+
6+
[package.build.backend]
7+
name = "pixi-build-rattler-build"
8+
version = "*"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
context:
2+
# Keep up to date
3+
version: "3.15"
4+
5+
package:
6+
name: python
7+
version: ${{ version }}
8+
9+
source:
10+
- path: ../../..
11+
12+
build:
13+
files:
14+
exclude:
15+
- "*.o"
16+
script:
17+
file: ../build.sh
18+
env:
19+
PYTHON_VARIANT: "free-threading"
20+
21+
# derived from https://github.com/conda-forge/python-feedstock/blob/main/recipe/meta.yaml
22+
requirements:
23+
build:
24+
- ${{ compiler('c') }}
25+
- ${{ compiler('cxx') }}
26+
- make
27+
- pkg-config
28+
# configure script looks for llvm-ar for lto
29+
- if: osx
30+
then:
31+
- llvm-tools
32+
- if: linux
33+
then:
34+
- ld_impl_${{ target_platform }}
35+
- binutils_impl_${{ target_platform }}
36+
- clang-19
37+
- llvm-tools-19
38+
39+
host:
40+
- bzip2
41+
- sqlite
42+
- liblzma-devel
43+
- zlib
44+
- zstd
45+
- openssl
46+
- readline
47+
- tk
48+
# These two are just to get the headers needed for tk.h, but is unused
49+
- xorg-libx11
50+
- xorg-xorgproto
51+
- ncurses
52+
- libffi
53+
- if: linux
54+
then:
55+
- ld_impl_${{ target_platform }}
56+
- libuuid
57+
- libmpdec-devel
58+
- expat
59+
60+
about:
61+
homepage: https://www.python.org/
62+
license: Python-2.0
63+
license_file: LICENSE

Tools/pixi-packages/tsan/pixi.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
platforms = ["osx-arm64", "linux-64"]
4+
preview = ["pixi-build"]
5+
6+
[package.build.backend]
7+
name = "pixi-build-rattler-build"
8+
version = "*"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
context:
2+
# Keep up to date
3+
version: "3.15"
4+
5+
package:
6+
name: python
7+
version: ${{ version }}
8+
9+
source:
10+
- path: ../../..
11+
12+
build:
13+
files:
14+
exclude:
15+
- "*.o"
16+
script:
17+
file: ../build.sh
18+
env:
19+
PYTHON_VARIANT: "tsan"
20+
21+
# derived from https://github.com/conda-forge/python-feedstock/blob/main/recipe/meta.yaml
22+
requirements:
23+
build:
24+
- ${{ compiler('c') }}
25+
- ${{ compiler('cxx') }}
26+
- make
27+
- pkg-config
28+
# configure script looks for llvm-ar for lto
29+
- if: osx
30+
then:
31+
- llvm-tools
32+
- if: linux
33+
then:
34+
- ld_impl_${{ target_platform }}
35+
- binutils_impl_${{ target_platform }}
36+
- clang-19
37+
- llvm-tools-19
38+
39+
host:
40+
- bzip2
41+
- sqlite
42+
- liblzma-devel
43+
- zlib
44+
- zstd
45+
- openssl
46+
- readline
47+
- tk
48+
# These two are just to get the headers needed for tk.h, but is unused
49+
- xorg-libx11
50+
- xorg-xorgproto
51+
- ncurses
52+
- libffi
53+
- if: linux
54+
then:
55+
- ld_impl_${{ target_platform }}
56+
- libuuid
57+
- libmpdec-devel
58+
- expat
59+
60+
about:
61+
homepage: https://www.python.org/
62+
license: Python-2.0
63+
license_file: LICENSE

0 commit comments

Comments
 (0)