Re: [PATCH v2] kbuild: rust: avoid creating temporary files

From: Masahiro Yamada
Date: Tue Jul 25 2023 - 01:01:34 EST


On Sun, Jul 23, 2023 at 11:21 PM Miguel Ojeda <ojeda@xxxxxxxxxx> wrote:
>
> `rustc` outputs by default the temporary files (i.e. the ones saved
> by `-Csave-temps`, such as `*.rcgu*` files) in the current working
> directory when `-o` and `--out-dir` are not given (even if
> `--emit=x=path` is given, i.e. it does not use those for temporaries).
>
> Since out-of-tree modules are compiled from the `linux` tree,
> `rustc` then tries to create them there, which may not be accessible.
>
> Thus pass `--out-dir` explicitly, even if it is just for the temporary
> files.
>
> Similarly, do so for Rust host programs too.
>
> Reported-by: Raphael Nestler <raphael.nestler@xxxxxxxxx>
> Closes: https://github.com/Rust-for-Linux/linux/issues/1015
> Reported-by: Andrea Righi <andrea.righi@xxxxxxxxxxxxx>
> Tested-by: Raphael Nestler <raphael.nestler@xxxxxxxxx> # non-hostprogs
> Tested-by: Andrea Righi <andrea.righi@xxxxxxxxxxxxx> # non-hostprogs
> Fixes: 295d8398c67e ("kbuild: specify output names separately for each emission type from rustc")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> ---
> v2:
> - Add fix for host programs too (Masahiro).


This is now available in the mainline.

df01b7cfcef08bf3fdcac2909d0e1910781d6bfd





--
Best Regards
Masahiro Yamada