M134 build issue: Rust `adler` -> `adler2` change

38 views
Skip to first unread message

Matt Jolly

unread,
Jan 17, 2025, 10:37:07 PMJan 17
to chromium-...@chromium.org, chro...@gentoo.org
Hi All,

Hope you all enjoyed the brief pause in releases over the holiday
period!

Just a courtesy message re: some changes to upstream Rust that will
likely impact on downstream packagers and hopefully save you a bit
of time working out what's changed.

Upstream Rust nightly has swapped out `adler` for `adler2`, a fork
of the original `adler` crate/library (`adler` is a library for
calculating Adler-32 checksums which are [typically] used in zlib
compression).

It seems that Rust-Lang don't maintain this library internally, and
the original source was archived on GitHub at some point.

```
tar tvf ~/Downloads/rust-nightly-x86_64-unknown-linux-gnu.tar.xz | grep
-i adler
-rw-r--r-- 0/0 28782 2025-01-18 06:53
rust-nightly-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler2-3d3fa22b868db521.rlib

```

Since Chromium have recently rolled Rust to a version that includes
this change, I got a bit confused when attempting to kick off a `dev`
channel build this morning: GN will attempt to copy a specific
list of libs from the system-provided sysroot into the build directory
if not using the bundled toolchain, if I'm reading the GN script
correctly.

This change results in a build error when attempting to build Chromium
with a Rust toolchain that doesn't include `adler2` (i.e. any version
that's actually been released).

```
FAILED:
default_for_rust_host_build_tools/prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler2.rlib

ln -f
default_for_rust_host_build_tools/obj/build/rust/std/libadler2.rlib
default_for_rust_host_build_tools/prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler2.rlib
2>/dev/null || (rm -rf
default_for_rust_host_build_tools/prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler2.rlib
&& cp -af
default_for_rust_host_build_tools/obj/build/rust/std/libadler2.rlib
default_for_rust_host_build_tools/prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler2.rlib)
cp: cannot stat
'default_for_rust_host_build_tools/obj/build/rust/std/libadler2.rlib':
No such file or directory
```

For those of us that don't happen to have nightly Rust in-use with
our distros for building packages and general compilation, it seems like
we can trivially reverse this in `build/rust/std/BUILD.gn` to enable
compilation with released versions of Rust.

I've used `sed` to do this conditionally, but the patch should be
trivial:

```
sed -i 's/adler2/adler/' build/rust/std/BUILD.gn
```

Since we're only impacting files copied in from system-installed Rust
(or whatever Rust was provided to GN), this seems to do the trick - or
at least GN and Rust haven't complained in the first half of my build
with this change implemented.

Hope this helps!

Cheers,

Matt
Reply all
Reply to author
Forward
0 new messages