rust: kbuild: disambiguate `zerocopy` for `rusttest`
Subsystems (3)
Miguel Ojeda
maintainerPATCH 1/1 rust: kbuild: disambiguate `zerocopy` for `rusttest`
From: Antoni Boucher <[email protected]>
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.rlibWe cannot use --sysroot=/dev/null for these, thus point to the dependency explicitly.
[ 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 ]
--- rust/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/Makefile +1 -1
@@ -350,7 +350,7 @@ rusttestlib-pin_init: $(src)/pin-init/src/lib.rs rusttestlib-macros \ rusttestlib-kernel: private rustc_target_flags = --extern ffi \ --extern build_error --extern macros --extern pin_init \ --extern bindings --extern uapi \ - --extern zerocopy --extern zerocopy_derive + --extern zerocopy=$(objtree)/$(obj)/test/libzerocopy.rlib --extern zerocopy_derive rusttestlib-kernel: $(src)/kernel/lib.rs rusttestlib-bindings rusttestlib-uapi \ rusttestlib-build_error rusttestlib-pin_init $(obj)/$(libmacros_name) \ $(obj)/bindings.o rusttestlib-zerocopy rusttestlib-zerocopy_derive FORCE
base-commit: fc02acf6ac0ccde0c805c2daa9148683cdd01ba8
Signature · 1 line
2.55.0
Miguel Ojeda
AppliedQuoted 26 lines · Miguel Ojeda
From: Antoni Boucher <[email protected]>
Starting with Rust 1.76.0,
zerocopywas added as an (indirect) compiler dependency [1]. In turn, this meant that therustc-devcomponent started including a precompiledzerocopycrate in the sysroot.This makes
rusttestfail 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.rlibWe cannot use
--sysroot=/dev/nullfor these, thus point to the dependency explicitly.Assisted-by LLMNot-yet-Signed-off-by Antoni Boucher <[email protected]>Fixes 567621523ab7 ("rust: zerocopy: enable support in kbuild")
Quoted 5 lines
[ 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. withrustc_codegen_gcc. - Miguel ]Signed-off-by Miguel Ojeda <[email protected]>
Applied to rust-next -- thanks!
I changed the Assisted-by tag with the details that Antoni gave me.
Cheers,
Miguel