nodejs toolchain resolution fails on M1 with rules_nodejs >= 5.6.0
mattsoulanille opened this issue Β· comments
π bug report
Affected Rule
The issue is caused by the rule: container_deps()
WORKSPACE rule.
Is this a regression?
I don't think so. I tried some earlier versions, including 0.20.0 (with repo mapping @nodejs
to @nodejs_host
), but the error persisted. My guess is this was caused by a change rules_nodejs
made that rules_docker
may need to adapt to. However, the breakage is between minor versions of rules_nodejs
, so this may be a regression on their side. I'm happy to create an issue there if necessary, and I'll see if I can find the cause by looking at the difference between 5.5.4
and 5.6.0
.
Description
When using rules_nodejs >= 5.6.0
on an Apple Silicon mac with rules_docker
, running container_deps()
in the WORKSPACE file to set up rules_docker
's deps results in the @rules_nodejs//nodejs:toolchain_type
toolchain not being resolved by rules like nodejs_binary
.
π¬ Minimal Reproduction
https://github.com/mattsoulanille/docker_rules_nodejs_issue
π₯ Exception or Error
% bazel run :index_bin --toolchain_resolution_debug='nodejs' --define=VERBOSE_LOGS=1
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_amd64//:node_toolchain; mismatching values: linux, x86_64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_amd64//:node_toolchain; mismatching values: linux, x86_64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_arm64//:node_toolchain; mismatching values: linux, arm64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_arm64//:node_toolchain; mismatching values: linux, arm64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_s390x//:node_toolchain; mismatching values: linux, s390x
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_s390x//:node_toolchain; mismatching values: linux, s390x
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_ppc64le//:node_toolchain; mismatching values: linux, ppc
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_ppc64le//:node_toolchain; mismatching values: linux, ppc
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_amd64//:node_toolchain; mismatching values: x86_64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_amd64//:node_toolchain; mismatching values: x86_64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_arm64//:node_toolchain; mismatching values: arm64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_arm64//:node_toolchain; mismatching values: arm64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_windows_amd64//:node_toolchain; mismatching values: windows, x86_64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_windows_amd64//:node_toolchain; mismatching values: windows, x86_64
INFO: ToolchainResolution: Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: No toolchains found.
ERROR: /Users/matthew/Projects/docker_rules_nodejs_issue/BUILD.bazel:3:14: While resolving toolchains for target //:index_bin: no matching toolchains found for types @rules_nodejs//nodejs:toolchain_type
ERROR: Analysis of target '//:index_bin' failed; build aborted:
INFO: Elapsed time: 0.272s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (38 packages loaded, 259 targets configured)
FAILED: Build did NOT complete successfully (38 packages loaded, 259 targets configured)
π Your Environment
Operating System:
MacOS 12.5 Apple Silicon
Output of bazel version
:
bazel 5.4.0
Rules_docker version:
0.25.0
Anything else relevant?
This might be a relevant change in rules_nodejs 5.5.4 -> 5.6.0.
"darwin_arm64": struct(
compatible_with = [
"@platforms//os:macos",
- "@platforms//cpu:aarch64",
+ "@platforms//cpu:arm64",
],
),
I've confirmed that this is the cause. I overrode the rules_nodejs
core repo locally and changed this line back to @platforms//cpu:aarch64
and it worked.
I checked this on arm linux as well (ubuntu docker on m1 mac), since rules_nodejs 5.5.4 -> 5.6.0
also renames the linux cpu, and I get the same error.
"linux_arm64": struct(
compatible_with = [
"@platforms//os:linux",
- "@platforms//cpu:aarch64",
+ "@platforms//cpu:arm64",
],
),
```
This appears to be an issue with rules_go 0.24.2
. Pinning rules_go
to 0.33.0 in my WORKSPACE file and using rules_docker
at 48ad6d6df43d1e4b9feeec961995aef01dd72080
before running container_deps()
seems to remove the error, although I haven't tested creating any containers yet.
I also had to pin gazelle
to 0.28.0
to get container_push
working.
So the real fix here is to update rules_go and gazelle in rules_docker?
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"