Skip to content

Commit fe39a23

Browse files
antoyoojeda
authored andcommitted
rust: kbuild: disambiguate zerocopy for rusttest
Starting with Rust 1.76.0, `zerocopy` was added as an (indirect) compiler dependency [1]. In turn, this meant that the `rustc-dev` component started including a precompiled `zerocopy` crate in the sysroot. This makes `rusttest` fail because the compiler finds several candidates: error[E0464]: multiple candidates for `rmeta` dependency `zerocopy` found --> rust/kernel/prelude.rs:64:9 | 64 | pub use zerocopy::{ | ^^^^^^^^ | = note: candidate #1: .../lib/rustlib/x86_64-unknown-linux-gnu/lib/libzerocopy-dfef4cb07ca752aa.rmeta = note: candidate #2: ./rust/test/libzerocopy.rlib We cannot use `--sysroot=/dev/null` for these, thus point to the dependency explicitly. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Antoni Boucher <[email protected]> Cc: [email protected] Fixes: 5676215 ("rust: zerocopy: enable support in kbuild") Link: rust-lang/rust#118546 [1] Link: https://patch.msgid.link/[email protected] [ Investigated when it started happening, reworded to add that and to follow our usual style and sent on behalf of Antoni, who found this during his work to support Rust for Linux with the GCC backend, i.e. with `rustc_codegen_gcc`. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent ec72b46 commit fe39a23

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎rust/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ rusttestlib-pin_init: $(src)/pin-init/src/lib.rs rusttestlib-macros \
350350
rusttestlib-kernel: private rustc_target_flags = --extern ffi \
351351
--extern build_error --extern macros --extern pin_init \
352352
--extern bindings --extern uapi \
353-
--extern zerocopy --extern zerocopy_derive
353+
--extern zerocopy=$(objtree)/$(obj)/test/libzerocopy.rlib --extern zerocopy_derive
354354
rusttestlib-kernel: $(src)/kernel/lib.rs rusttestlib-bindings rusttestlib-uapi \
355355
rusttestlib-build_error rusttestlib-pin_init $(obj)/$(libmacros_name) \
356356
$(obj)/bindings.o rusttestlib-zerocopy rusttestlib-zerocopy_derive FORCE

0 commit comments

Comments
 (0)