Closed khuey closed 4 months ago
Perhaps @jclulow would be interested in figuring out how to get the zstd crate to build on illumos.
Perhaps @jclulow would be interested in figuring out how to get the zstd crate to build on illumos.
Out of curiosity, what failure(s) are you seeing in the build?
Perhaps @jclulow would be interested in figuring out how to get the zstd crate to build on illumos.
Out of curiosity, what failure(s) are you seeing in the build?
It dies complaining that gar
is not available.
It dies complaining that
gar
is not available.
Which distribution are you attempting this on? On OmniOSCE, gar
appears to be provided by pkg:/developer/gnu-binutils
It dies complaining that
gar
is not available.Which distribution are you attempting this on? On OmniOSCE,
gar
appears to be provided bypkg:/developer/gnu-binutils
Based on https://github.com/rust-lang/backtrace-rs/blob/master/.github/workflows/main.yml#L220, I suppose it's attempting a cross-compile from standard Ubuntu to illumos.
Unlike zlib compression, the most widely used Rust library for zstd is a set of bindings to the zstd C library. There does exist a Rust reimplementation (ruzstd) however the author claims it is significantly slower than the C library and it sees substantially less usage, so I have not used it here.
If the performance is still somewhat reasonable, I don't see it as too big of a deal to use it anyway. Backtrace symbolication is not on the performance critical path anyway (panics are supposed to be uncommon and only symbolize when RUST_BACKTRACE
is set and errors with backtraces captured only symbolize when actually printed) and decompression should happen only once and cached for further symbolication queries.
I just saw that the libzstd C library is licensed as BSD-3-Clause OR GPL-2.0. GPL-2.0 is definitively out for a standard library dependency. As for BSD-3-Clause, the rust compiler has some dependencies that use it, but it isn't in tidy's list of permitted licenses for the standard library. https://github.com/rust-lang/rust/blob/9e297bf54d31eb3b30067208ff9af4416945a2ed/src/tools/tidy/src/deps.rs#L12-L33 I will ask on zulip if it is fine to add to the list of allowed licenses.
The README for ruzstd suggests a roughly 1.4x to 3.5x slowdown, and it seems significantly less complex to me -- it's really nice to have a pure-Rust standard library dependency tree, even on targets that usually have C compilers, for things like cross-compilation x.py check. I would be in favor of avoiding taking a dependency on real zstd in std, even if perhaps backtrace-rs does offer that (feature gated).
It dies complaining that
gar
is not available.Which distribution are you attempting this on? On OmniOSCE,
gar
appears to be provided bypkg:/developer/gnu-binutils
Based on https://github.com/rust-lang/backtrace-rs/blob/master/.github/workflows/main.yml#L220, I suppose it's attempting a cross-compile from standard Ubuntu to illumos.
Yea, compiling on illumos itself works fine but cross-compiling would require a suitable illumos sysroot. One way is the approach used in the Rust repo to build it in docker:
But that does increase overall ci time having to build gcc & friends. A pure rust solution would simplify things.
There's an alternative PR using a Rust reimplementation of zstd (the ruzstd crate) in #626. Pick your poison 😄
I have been very vocal about not significantly raising the maintenance burden of this crate, so it would be out-of-character for me to accept this. I will review #626.
zstd has been introduced as an alternative to zlib for the compression of debug sections.[0] Toolchain support is widely present at this time but lack of support in backtrace is a severe limitation on using this feature in Rust programs.
Unlike zlib compression, the most widely used Rust library for zstd is a set of bindings to the zstd C library. There does exist a Rust reimplementation (ruzstd) however the author claims it is significantly slower than the C library and it sees substantially less usage, so I have not used it here.
Using the C library poses challenges because it requires compiling native code. I made a few adjustments to the CI configuration to make that possible on all platforms, and pinned the zstd crate to a slightly older version due to gyscos/zstd-rs#271 breaking the crate on wasm targets on the very latest version. Additionally, I've disabled this entirely on illumos rather than try to get native code to compile successfully there.
[0] https://maskray.me/blog/2022-09-09-zstd-compressed-debug-sections