Re: [PATCH V7 1/4] rust: Fix a race condition in Makefile

Gary Guo
2026-03-29T18:27:29Z

On Sun Mar 29, 2026 at 6:25 PM BST, Miguel Ojeda wrote:
> On Sun, Mar 29, 2026 at 6:03 PM Mukesh Kumar Chaurasiya (IBM)
> <mkchauras@gmail.com> wrote:
>>
>> When compiling with -j1 flag in powerpc, the libproc_macro finds the
>> libcore.rmeta both in toolchain and local rust directory. libproc_macro
>> should use the toolchain provided libcore.rmeta.
>
> By toolchain, do you mean the sysroot one or something else?
>
> We should make it such that `rustc` does not try to use them to begin
> with, e.g. we added `--sysroot=/dev/null` to prevent that in the past,
> please see:
>
> 71479eee9da8 ("rust: Suppress searching builtin sysroot")
>
> In other words, we should try to avoid adding dependencies (even if
> order-only) to workaround the issue, but instead we should get rid of
> the root issue.
>
> Otherwise, after a build, if we rebuild only one of them, wouldn't it
> find again both? i.e. this is not really a "race condition".
>
> From the original message, I see this was happening when building the
> host libraries, because the targets happen to match, i.e. you are
> doing a native build on powerpc, right?
>
> Perhaps we could put the host `.rmeta`s separately, or something like that.

Yeah, we can either remove `-L$(objtree)/$(obj)` and specify `--extern
dep=path-to-dep`, or we can store host libraries to something like
`$(objtree)/$(obj)/host` and use that instead.

The latter should be an easier fix. Also, I can see that we're already having
`-L$(objtree)/$(obj)/test`.

Best,
Gary