Re: [PATCH v2] Kbuild: fix issues with rustc-option
From: Miguel Ojeda
Date: Tue Oct 08 2024 - 16:53:18 EST
On Tue, Oct 8, 2024 at 10:23 PM Matthew Maurer <mmaurer@xxxxxxxxxx> wrote:
>
> In that case we should omit `-o $$TMP`, because `rustc` is emitting a
> warning that it's ignoring `--out-dir` because `-o` is set.
Yes, we need to omit `-o` or we could use `--out-dir` together with
one of the `--emit=X=...` types to be more explicit and avoid building
the `.rlib`, which is what I did in the GitHub issue.
IIRC I used `obj` to run most of the compiler stages just in case that
mattered, but perhaps an even simpler one is good enough, e.g.
`metadata`.
I think just `--out-dir` should be fine and is simpler for this use
case. However, apparently outputting to stdout works too, so we could
do:
--emit=obj=- - >/dev/null
and avoid the output file altogether. We still most likely need the
`--out-dir` in case temporaries are created.
Cheers,
Miguel