astral-sh / astral-sh/python-build-standalone
Rethink musl-clang
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 314
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 27
Description
In both build-cpython.sh and build-zstd.sh we have some workarounds for the fact that musl-clang suppresses the vectorized math intrinsics headers that are shipped with clang. We've also had other issues with it, notably that the command name leaks out in sysconfig and end users may not have a command with that name - there are a few issues on this issue tracker and uv's.(See also discussion in an internal channel starting at https://discord.com/channels/1039017663004942429/1344040998724046920/1346959405081694350 .) Also there's no `musl-clang++` and we have a `# TODO: Explore a musl-clang++ shim?`.
The thing that [musl-clang](https://git.musl-libc.org/cgit/musl/tree/tools/musl-clang.in) does is relatively uncomplicated and there's probably a way to do it better. It might be as simple as adding to CPPFLAG `-nostdinc --sysroot /prefix/to/musl -isystem /prefix/to/musl/include`, and to LDFLAGS `-static-libgcc --sysroot /prefix/to/musl -nostdlib -lc -Wl,-dynamic-linker,/lib/ld-musl-whatever.so`. Or we create a custom sysroot, or something.
This would also save us some subprocesses by avoiding a shell wrapper, marginally speeding up the build.
Contributor guide
Assessment
This issue has not been assessed yet.