This is a minimal repro case for a path mapping issue with Rustc actions. I think the issue lies somewhere between hermetic-llvm, rules_rust, rules_rs, and rules_cc, but I could be off.
Build the Rust binary:
bazel build //:helloThe build fails with a linker error like the following:
ld.lld: error: cannot open crt1.o: No such file or directory
ld.lld: error: cannot open crti.o: No such file or directory
ld.lld: error: cannot open crtbegin.o: No such file or directory
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lutil
ld.lld: error: unable to find library -lrt
ld.lld: error: unable to find library -lpthread
ld.lld: error: unable to find library -lm
ld.lld: error: unable to find library -ldl
ld.lld: error: unable to find library -lc
ld.lld: error: unable to find library -lpthread
ld.lld: error: unable to find library -ldl
ld.lld: error: cannot open crtend.o: No such file or directory
ld.lld: error: cannot open crtn.o: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
To mitigate the issue disable path mapping for Rustc actions by uncommenting this line in .bazelrc:
common --modify_execution_info=Rustc=-supports-path-mapping
Then build the target again. It should succeed.
bazel build //:hello