Unable to read target specs when rust 1.73 is bootstrapped in yocto poky

When executing python3 src/bootstrap/bootstrap.py test in poky rust sources,

After building stage1 library artifacts, the rust build fails as follows-

error: output of --print=file-names missing when learning about target-specific information from rustc

Similar issues were raised in rust github issues (#116698 and #108343) which suggested to uninstall rust using rustup.

But, poky doesn't have rustup binary when rust is build. I am trying here to build the rust sources and then run all the rust test suites.

The respective x86_64-unknown-linux-gnu.json file is generated in the build but is not been fetched/read to give rustc --print file-names output during build process.
Why is this error shown and how to fix it?

Can you post the full error message?

Full error message -

| Building stage1 library artifacts (x86_64-unknown-linux-gnu)

| error: output of --print=file-names missing when learning about target-specific information from rustc

| command was: /rust173/build/tmp/work/x86_64-linux/rust-native/1.73.0/rustc-1.73.0-src/build/bootstrap/debug/rustc - --crate-name ___ --print=file-names --remap-path-prefix=/rust173/build/tmp/work/x86_64-linux/rust-native/1.73.0=/usr/src/debug/rust-native/1.73.0-r0 -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(freebsd13)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_vendor,"unikraft")' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_os,"teeos")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","xtensa","mips32r6","mips64r6","csky")' -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Cembed-bitcode=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/1.73.0/")' --target x86_64-unknown-linux-gnu --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg

If you manually run the mentioned command, what do you get as output?

@bjorn3

Output -
rustc shim: fatal: RUSTC_STAGE was not set
rustc shim: note: use x.py build -vvv to see all environment variables set by bootstrap

Similar error is mentioned in 100224.

@bjorn3 , any update on this?