Cross-compilation with Bzlmod not working
Hi folks, I'm experimenting with rules_rust to build a monolithic Rust app I'm working on.
One of the requirements I have is to target both linux-arm64 and linux-amd64 as deployment environments.
I'm developing locally on an M1 machine, so darwin-arm64.
I've added the hermetic_cc_toolchain Zig toolchains for cross-compilation, and added two explicit build targets (repro-app_linux-arm64 & repro-app_linux-amd64 in the example below) to build for both environments with bazel build.
However, I'm having issues while running either that or bazel test //...
This is the error I get:
= note: ld: library not found for -liconv
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
I've created a small example to reproduce the issue: https://github.com/ar3s3ru/repro-rules-rust-cross-compile
I've had a similar issue as well, If I remember correctly, switching from hermetic_cc_toolchain to using the locally installed clang had worked.
Although, my situation was reversed. we had to target darwin-arm64 from linux-arm64, but the error was the same.
@firekind if you were targeting darwin, then you likely hit this issue: https://github.com/uber/hermetic_cc_toolchain/issues/10