* [PATCH] rust: kbuild: disambiguate `zerocopy` for `rusttest`
@ 2026-07-29 17:38 Miguel Ojeda
2026-08-03 6:48 ` Miguel Ojeda
0 siblings, 1 reply; 2+ messages in thread
From: Miguel Ojeda @ 2026-07-29 17:38 UTC (permalink / raw)
To: Miguel Ojeda, Nathan Chancellor, Nicolas Schier
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, rust-for-linux, linux-kbuild, Antoni Boucher,
stable
From: Antoni Boucher <bouanto@zoho.com>
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: LLM
Not-yet-Signed-off-by: Antoni Boucher <bouanto@zoho.com>
Link: https://github.com/rust-lang/rust/pull/118546 [1]
Cc: stable@vger.kernel.org
Fixes: 567621523ab7 ("rust: zerocopy: enable support in kbuild")
[ 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 <ojeda@kernel.org>
---
rust/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index 627ed79dc6f5..fbe0accc51a3 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -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
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rust: kbuild: disambiguate `zerocopy` for `rusttest`
2026-07-29 17:38 [PATCH] rust: kbuild: disambiguate `zerocopy` for `rusttest` Miguel Ojeda
@ 2026-08-03 6:48 ` Miguel Ojeda
0 siblings, 0 replies; 2+ messages in thread
From: Miguel Ojeda @ 2026-08-03 6:48 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, rust-for-linux, linux-kbuild,
Antoni Boucher, stable
On Wed, Jul 29, 2026 at 7:38 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> From: Antoni Boucher <bouanto@zoho.com>
>
> 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: LLM
> Not-yet-Signed-off-by: Antoni Boucher <bouanto@zoho.com>
> Link: https://github.com/rust-lang/rust/pull/118546 [1]
> Cc: stable@vger.kernel.org
> Fixes: 567621523ab7 ("rust: zerocopy: enable support in kbuild")
> [ 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 <ojeda@kernel.org>
Applied to `rust-next` -- thanks!
I changed the Assisted-by tag with the details that Antoni gave me.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-03 6:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 17:38 [PATCH] rust: kbuild: disambiguate `zerocopy` for `rusttest` Miguel Ojeda
2026-08-03 6:48 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox