Commit 0f9ed18
committed
xtask: Add
Add a submcommand that prints the full URL of a musl sysroot tarball
from Gentoo[0][1] for the given architecture.
These tarballs are convenient to use for building bpf-linker for the
`*-unknown-linux-musl` targets in GitHub actions. They contain static
libstdc++ that's linked to musl.
We need to link libstdc++ becuase libLLVM provided by Rust CI are
linked dynamically to it. Producing a static binary requires a static
libstdc++ to provide missing symbols.
Building bpf-linker for `*-unknown-linux-musl` targets using Ubuntu's
libstdc++ does not work because it's linked dynamically to glibc,
causing linking errors like:
```
(.text._ZNSt6locale13_S_initializeEv+0x0): undefined reference to `__libc_single_threaded'
```
Using Gentoo's tarball and referencing it in `CXXSTDLIB` variable
solves the problem. After unpacking the tarball to `sysroot/`, one can
build a static binary using the following command on any distro:
```
RUSTFLAGS="-C target-feature=+crt-static" \
CXXSTDLIB_PATH="$(dirname $(find sysroot/ -name libstdc++.a))" \
cargo +nightly test \
--features llvm-21,llvm-link-static --no-default-features \
--target x86_64-unknown-linux-musl
```
Why Gentoo? It's more convenient than the considered alternatives:
- Alpine Linux minirootfs[2] does not contain libstdc++. Neither does
Void Linux rootfs[3]. One would need to chroot into it the sysroot and
install it, which requires more work.
- musl.cc[4] did not provide any update update since 2021.
- Chimera Linux[5] uses LLVM libc++.
[0] https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-musl/
[1] https://distfiles.gentoo.org/releases/arm64/autobuilds/current-stage3-arm64-musl/
[2] https://www.alpinelinux.org/downloads/
[3] https://voidlinux.org/download/#download-installable-base-live-images-and-rootfs-tarballs
[4] https://musl.cc/
[5] https://chimera-linux.org/musl-sysroot-url subcommand1 parent 7862791 commit 0f9ed18
4 files changed
+55
-1
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| |||
202 | 205 | | |
203 | 206 | | |
204 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
205 | 255 | | |
206 | 256 | | |
207 | 257 | | |
| |||
329 | 379 | | |
330 | 380 | | |
331 | 381 | | |
| 382 | + | |
332 | 383 | | |
333 | 384 | | |
334 | 385 | | |
0 commit comments