Problems with cargo-bazel and cargo when using rules_rust crates_universe (bzlmod) #2879
-
This is written bearing in mind that the rules_rust documentation states the following regarding Bzlmod: Note that rules_rust bzlmod support is still a work in progress. Most features should work, but bugs are more likely. This is not a desired end-state - please report (or better yet, help fix!) bugs you run into. BackgroundWe have developed a tool in Rust that we would like to use in a large project. This tool generates C++ source code files from an input and the tool is working as want it to. The large project uses bazel for its build system so we decided to start using bazel and rules_rust as the build system for this tool. That now works and the build WORKSPACE is defined using a Problem DescriptionHowever we encounter problems when pushing this integration to our CI pipeline where we encounter problems cargo-bazel, a binary built from Rust sources in rules_rust, and we have not been able to isolate the problem, for which an issue #2874 has been raised. That problem was detected in a production build environment where Questions
The problem can be easily recreated and we can use that environment for further debugging and testing. Any help to better understand the problems we are encountering would be really appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I managed to solve my problems with two fixes. Firstly the build failure described in issue #2874 was solved by mapping /etc/passwd from host to container when running the docker container build image, e.g. by adding the following argument to the docker run command: --volume /etc/passwd:/etc/passwd:ro Secondly, we are using JFrog Artifactory to host the cargo registry, requiring rules_rust to be configured to use that registry (config.toml) by: crate.from_specs(
cargo_config = "//:config.toml",
) |
Beta Was this translation helpful? Give feedback.
I managed to solve my problems with two fixes.
Firstly the build failure described in issue #2874 was solved by mapping /etc/passwd from host to container when running the docker container build image, e.g. by adding the following argument to the docker run command:
Secondly, we are using JFrog Artifactory to host the cargo registry, requiring rules_rust to be configured to use that registry (config.toml) by: