-
-
Notifications
You must be signed in to change notification settings - Fork 719
Closed
Description
Summary
Hi team. First of all thank you for all what you're doing. I recently stumbled upon an issue which looks like regression. After PR 4439 landed, some Go targets in the our configuration end up in different “pure” modes depending on whether a C/C++ toolchain is resolvable for that specific target. This leads to a mode mismatch during go_proto_library analysis. I would appreciate if you could take a look on it
Use case
I'm not sure exactly how to reproduce the issue, but roughly our usecase look like this:
proto_library(
name = "example_proto",
srcs = ["example.proto"],
)
go_proto_library(
name = "example_go_proto",
importpath = "example.org/project/example",
proto = ":example_proto",
)
go_binary(
name = "binary",
srcs = ["main.go"],
deps = [":example_go_proto"],
)Environment
- rules_go version: master (commit after PR 4439)
- Host/Execution platform: macOS
- Target platform: linux/arm64
Error
ERROR: /.../BUILD.bazel:11:17: in go_proto_library rule //golang/proto:example_go_proto:
Traceback (most recent call last):
File "/private/var/tmp/_bazel_dbieliaiev/8c62e38a32f8dc70f07523f1ae120a02/external/io_bazel_rules_go/proto/def.bzl", line 166, column 29, in _go_proto_library_impl
archive = go.archive(go, go_info)
File "/private/var/tmp/_bazel_dbieliaiev/8c62e38a32f8dc70f07523f1ae120a02/external/io_bazel_rules_go/go/private/actions/archive.bzl", line 86, column 17, in emit_archive
fail("Archive mode does not match {} is {} expected {}".format(a.data.label, mode_string(a.source.mode), mode_string(go.mode)))
Error in fail: Archive mode does not match @com_github_golang_protobuf//proto:proto is linux_arm64_stripped expected linux_arm64_pure_stripped
ERROR: /.../BUILD.bazel:11:17: Analysis of target '//golang/proto:example_go_proto' failed
The failure is reproducible on master.
Why this looks like a regression introduced by PR 4439
The behavior change appears tied to go/private/context.bzl logic introduced/modified in PR 4439. Specifically this branch:
If I remove this lines:
if getattr(attr, "_cc_toolchain", None) and CPP_TOOLCHAIN_TYPE in ctx.toolchains:
cgo_context_info = cgo_context_data_impl(ctx)The build succeeds.
Additional context: why we are on master
- We require features from
>= 0.56.0, specifically PR 4397. - All released versions versions
>= 0.56.0still exhibits issue 3945. - The fix landed in PR 4432, which has not been released yet.
- Therefore I pinned to a master commit but found out this regression.
Metadata
Metadata
Assignees
Labels
No labels