Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Allow users to recompile protoc #115

Open
googleson78 opened this issue Mar 22, 2022 · 6 comments
Open

[Feature request] Allow users to recompile protoc #115

googleson78 opened this issue Mar 22, 2022 · 6 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee)

Comments

@googleson78
Copy link

googleson78 commented Mar 22, 2022

I would like to have some way to tell rules_proto "please recompile protoc".

I came upon this while trying to use rules_proto on nixos, which doesn't have ld in /lib64/ld-linux-x86-64.so.2, as is expected by the prebuilt binaries. If it's instead rebuilt, things work fine.

I've implemented some solution in #114

@comius
Copy link
Collaborator

comius commented Mar 22, 2022

Isn't it enough to set --proto_compiler=@com_github_protocolbuffers_protobuf//:protoc?

@comius comius added the P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) label Mar 22, 2022
@googleson78
Copy link
Author

I didn't know that flag exists. Thanks :). But it still seems to not work for some reason - I get a binary that still depends on the linker in the usual place

raider :: » file ./bazel-out/k8-opt-exec-FFB32019/bin/external/com_google_protobuf_protoc_linux_x86_64/protoc.exe  
                                                                                                                       
./bazel-out/k8-opt-exec-FFB32019/bin/external/com_google_protobuf_protoc_linux_x86_64/protoc.exe: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=1b078080620f7b15
0ba8d0a195d68275b03d075e, stripped

I think this forces bazel to recompile protoc, but rules_bazel still depends on the prebuilt version 🤔

@Yannic
Copy link
Collaborator

Yannic commented Mar 22, 2022

Most Starlark rules hardcode @com_google_protobuf//:protoc because the flag is not exposed, so I'm not super surprised that doesn't work.

Can you share which language/<lang>_proto_library rule this is please?

@googleson78
Copy link
Author

go_proto_library and ts_proto_library both fail.

@Yannic
Copy link
Collaborator

Yannic commented Mar 22, 2022

As expected, go_proto_library hardcodes it: https://github.com/bazelbuild/rules_go/blob/8553d97674742ad4c110cffa999017db21052b97/proto/compiler.bzl#L218

@comius
Copy link
Collaborator

comius commented Mar 23, 2022

This is a problem of go_proto_library and ts_proto_library. I'm working on proposal that will expose the right functionality so those implementations can be fixed (but they can't be fixed at the moment).

https://docs.google.com/document/d/1dY_jfRvnH8SjRXGIfg8av-vquyWsvIZydXJOywvaR1A/edit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
Projects
None yet
Development

No branches or pull requests

3 participants