|
1 | 1 | # CPython Pixi packages |
2 | 2 |
|
3 | | -This directory contains definitions for [Pixi packages](https://pixi.sh/latest/reference/pixi_manifest/#the-package-section) |
4 | | -which can be built from the CPython source code. |
| 3 | +This directory contains definitions for [Pixi |
| 4 | +packages](https://pixi.sh/latest/reference/pixi_manifest/#the-package-section) which can |
| 5 | +be built from the CPython source code. |
5 | 6 |
|
6 | | -Downstream developers can make use of these packages by adding them as Git dependencies in a |
7 | | -[Pixi workspace](https://pixi.sh/latest/first_workspace/), like: |
| 7 | +Downstream developers can make use of these packages by adding them as Git dependencies |
| 8 | +in a [Pixi workspace](https://pixi.sh/latest/first_workspace/), like: |
8 | 9 |
|
9 | 10 | ```toml |
10 | 11 | [dependencies] |
11 | | -python = { git = "https://github.com/python/cpython", subdirectory = "Tools/pixi-packages/asan" } |
| 12 | +python.git = "https://github.com/python/cpython" |
| 13 | +python.subdirectory = "Tools/pixi-packages/asan" |
12 | 14 | ``` |
13 | 15 |
|
14 | 16 | 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 |
| 17 | +(for example, for an ASan or TSan-instrumented build), as it does not require any manual |
16 | 18 | clone or build steps. Instead, Pixi will automatically handle both the build |
17 | 19 | and installation of the package. |
18 | 20 |
|
19 | 21 | Each package definition is contained in a subdirectory, but they share the build script |
20 | 22 | `build.sh` in this directory. Currently defined package variants: |
21 | 23 |
|
22 | 24 | - `default` |
23 | | -- `asan`: ASan-instrumented build with `PYTHON_ASAN=1` |
| 25 | +- `freethreading` |
| 26 | +- `asan`: ASan-instrumented build |
| 27 | +- `tsan-freethreading`: TSan-instrumented free-threading build |
24 | 28 |
|
25 | 29 | ## Maintenance |
26 | 30 |
|
27 | | -- Keep the `version` fields in each `recipe.yaml` up to date with the Python version |
28 | | -- Keep the dependency requirements up to date in each `recipe.yaml` |
| 31 | +- Keep the `abi_tag` and `version` fields in each `variants.yaml` up to date with the |
| 32 | + Python version |
29 | 33 | - Update `build.sh` for any breaking changes in the `configure` and `make` workflow |
30 | 34 |
|
31 | 35 | ## Opportunities for future improvement |
32 | 36 |
|
33 | | -- More package variants (such as TSan, UBSan) |
| 37 | +- More package variants (such as UBSan) |
34 | 38 | - Support for Windows |
35 | | -- Using a single `pixi.toml` and `recipe.yaml` for all package variants is blocked on https://github.com/prefix-dev/pixi/issues/4599 |
36 | | -- A workaround can be removed from the build script once https://github.com/prefix-dev/rattler-build/issues/2012 is resolved |
| 39 | +- Using a single `pixi.toml` and `recipe.yaml` for all package variants is blocked on |
| 40 | + [pixi-build-backends#532](https://github.com/prefix-dev/pixi-build-backends/pull/532) |
| 41 | + and [pixi#5248](https://github.com/prefix-dev/pixi/issues/5248) |
| 42 | + |
| 43 | +## Troubleshooting |
| 44 | + |
| 45 | +TSan builds may crash on Linux with |
| 46 | +``` |
| 47 | +FATAL: ThreadSanitizer: unexpected memory mapping 0x7977bd072000-0x7977bd500000 |
| 48 | +``` |
| 49 | +To fix it, try reducing `mmap_rnd_bits`: |
| 50 | + |
| 51 | +```bash |
| 52 | +$ sudo sysctl vm.mmap_rnd_bits |
| 53 | +vm.mmap_rnd_bits = 32 # too high for TSan |
| 54 | +$ sudo sysctl vm.mmap_rnd_bits=28 # reduce it |
| 55 | +vm.mmap_rnd_bits = 28 |
| 56 | +``` |
0 commit comments