Open gleyba opened 1 year ago
As a workaround can you manually register @rules_foreign_cc//toolchains:built_ninja
as a toolchain in your MODULE.bazel file?
That doesn't work for me, at least as I understood your instructions. I added:
register_toolchains("@rules_foreign_cc//toolchains:built_ninja")
It said:
ERROR: /home/jwb/.cache/bazel/_bazel_jwb/3830abeb7aeb4099e44e90affdf34226/external/rules_foreign_cc~0.9.0/toolchains/BUILD.bazel:192:11: While resolving toolchains for target @rules_foreign_cc~0.9.0//toolchains:ninja_tool: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '@[unknown repo 'rules_python' requested from @rules_foreign_cc~0.9.0]//python': The repository '@[unknown repo 'rules_python' requested from @rules_foreign_cc~0.9.0]' could not be resolved: No repository visible as '@rules_python' from repository '@rules_foreign_cc~0.9.0'
ERROR: /home/jwb/.cache/bazel/_bazel_jwb/3830abeb7aeb4099e44e90affdf34226/external/zstd/BUILD.bazel:10:6: While resolving toolchains for target @zstd//:zstd: invalid registered toolchain '@rules_foreign_cc~0.9.0//toolchains:built_ninja':
ERROR: Analysis of target '@zstd//:zstd' failed; build aborted:
Based on the error message I also tried rearranging the modules so rules_python comes first, but that had no effect. Downgrading to 0.8.0 also had no benefits.
AH, right - yes the version in the bzlmod registry likely doesn't have the required dependency on rules_python. bzlmod support in rules_foreign_cc needs some more work; I've done some of this on a branch but its not yet ready to land and my time to look at this is rather limited.
I humbly suggest that if it's not ready to use, consider removing it from the central registry. I wasted some time trying to move this from workspace to bzlmod.
It works when the toolchains are using the prebuilt ones. The central registry has a policy that old packages can't be modified once in place as people may be depending on them so it can't be removed. That specific version was added to the registry whilst the registry was still in alph / beta. Contributions to help get bzlmod working with platforms other than linux x86_64 are gratefully accepted!
I am the human embodiment of "no idea dog" when it comes to these rules, but I will take a stab at it.
seems like this wasn't just about the missing dep since the same issue hits with 0.10.1
Ninja 1.12.0 has binaries for linux aarch64 - have added a PR to add support for this in #1192.
So when it will be released?
Using bzlmod: https://registry.bazel.build/modules/rules_foreign_cc When running on arm64 linux:
ERROR: /home/teamcityagent/.cache/bazel/_bazel_teamcityagent/31947da297a308d788c9ead81407d6ae/external/com_github_cares_cares/BUILD.bazel:8:6: While resolving toolchains for target @com_github_cares_cares//:cares: No matching toolchains found for types @rules_foreign_cc~0.9.0//toolchains:ninja_toolchain.