Skip to content

Question about precompiled protoc #402

@MrDan4es

Description

@MrDan4es

Hello. In version 4.0, you removed the precompiled protoc, and now it recompiles frequently (bazelbuild/bazel#7095).
Alex Eagle presented a solution that replaces the original toolchain (https://github.com/aspect-build/toolchains_protoc), but now this solution is incompatible with the new version of build_stack_rules_proto.

module(name = "module")

...
bazel_dep(name = "toolchains_protoc", version = "0.5.0")
bazel_dep(name = "build_stack_rules_proto", version = "4.1.0")
...

protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
protoc.toolchain(
    google_protobuf = "com_google_protobuf",
    version = "v29.0",
)
use_repo(protoc, "com_google_protobuf")

register_toolchains("@build_stack_rules_proto//toolchain:standard")

When i trying to build any proto files with opts

common --per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --host_per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --host_per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT

i got gcc: error: unrecognized command-line option '--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT'

How can I use the toolchain from toolchains_protoc when building proto_plugin?
Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions