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
Duplicate symbol issue with bazel and blacklisted_protos #7046
Comments
This was referenced Dec 23, 2019
rebello95
added a commit
to envoyproxy/envoy-mobile
that referenced
this issue
Dec 31, 2019
Fixes #617, which resulted in duplicate symbols from protobuf being present in the final Envoy Mobile binary. The [root cause](bazelbuild/bazel#10484) is being [patched in Bazel](bazelbuild/bazel#10493). In the meantime, we can revert these two commits in protobuf ([first](protocolbuffers/protobuf@7b28278), [second](protocolbuffers/protobuf@a03d332)) and apply the diff as a patch until we're able to update Bazel with the fix. More context on the protobuf issue is available [here](protocolbuffers/protobuf#7046). Notes: - This should be reverted after updating Bazel with the fix - The version of protobuf specified in the `http_archive` should be in lockstep with upstream Envoy's version - Upstream Envoy's `@envoy//bazel:protobuf.patch` patch is also included here Signed-off-by: Michael Rebello <me@michaelrebello.com>
Looks like gRPC is facing the same problem and it's preventing us from upgrading to protobuf 3.11.2. |
@jtattermusch Looks like gRPC got it sorted out. |
We've also addressed this in protobuf. |
jpsim
pushed a commit
to envoyproxy/envoy
that referenced
this issue
Nov 28, 2022
Fixes envoyproxy/envoy-mobile#617, which resulted in duplicate symbols from protobuf being present in the final Envoy Mobile binary. The [root cause](bazelbuild/bazel#10484) is being [patched in Bazel](bazelbuild/bazel#10493). In the meantime, we can revert these two commits in protobuf ([first](protocolbuffers/protobuf@7b28278), [second](protocolbuffers/protobuf@a03d332)) and apply the diff as a patch until we're able to update Bazel with the fix. More context on the protobuf issue is available [here](protocolbuffers/protobuf#7046). Notes: - This should be reverted after updating Bazel with the fix - The version of protobuf specified in the `http_archive` should be in lockstep with upstream Envoy's version - Upstream Envoy's `@envoy//bazel:protobuf.patch` patch is also included here Signed-off-by: Michael Rebello <me@michaelrebello.com> Signed-off-by: JP Simard <jp@jpsim.com>
jpsim
pushed a commit
to envoyproxy/envoy
that referenced
this issue
Nov 29, 2022
Fixes envoyproxy/envoy-mobile#617, which resulted in duplicate symbols from protobuf being present in the final Envoy Mobile binary. The [root cause](bazelbuild/bazel#10484) is being [patched in Bazel](bazelbuild/bazel#10493). In the meantime, we can revert these two commits in protobuf ([first](protocolbuffers/protobuf@7b28278), [second](protocolbuffers/protobuf@a03d332)) and apply the diff as a patch until we're able to update Bazel with the fix. More context on the protobuf issue is available [here](protocolbuffers/protobuf#7046). Notes: - This should be reverted after updating Bazel with the fix - The version of protobuf specified in the `http_archive` should be in lockstep with upstream Envoy's version - Upstream Envoy's `@envoy//bazel:protobuf.patch` patch is also included here Signed-off-by: Michael Rebello <me@michaelrebello.com> Signed-off-by: JP Simard <jp@jpsim.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of protobuf and what language are you using?
Version: v3.10.1
Language: C++
What operating system (Linux, Windows, ...) and version?
macOS 10.14.6 targeting iOS 11.0
What runtime / compiler are you using
clang 11.0 (Xcode 11.2.1)
General description
When building envoy-mobile we discovered there's an issue with protobuf where symbols are duplicated in the binary that is produced. This started when we updated protobuf from v3.9.2 and I narrowed this down to these 2 BUILD file changes:
7b28278
a03d332
It appears that when using
proto_library
targets as yourproto_lang_toolchain
'sblacklisted_protos
s, it does not have the same effect as before (I've filed this bazel bug since I assume this is an issue there bazelbuild/bazel#10484).What did you do?
Steps to reproduce the behavior:
envoy-mobile/envoy/bazel/protobuf.patch
bazel aquery 'deps(ios_dist)' --override_repository=com_google_protobuf=/path/to/protobuf --output=textproto > /tmp/after.proto
git checkout v3.9.2 -- BUILD
to get the older version of the BUILD filebazel aquery 'deps(ios_dist)' --override_repository=com_google_protobuf=/path/to/protobuf --output=textproto > /tmp/before.proto
bazel run //tools/aquery_differ -- --before=/tmp/before.proto --after=/tmp/after.proto --input_type=textproto --attrs=inputs --attrs=cmdline | less
You can also use this aquery method to see that on the v3.10.1 tag removing
blacklisted_protos
entirely has no effect on the build, which isn't what we would expect. If you do the same test removingblacklisted_protos
on the v3.9.2 tag you will see there's a similar difference as above where these libraries are included that shouldn't be.What did you expect to see
The libraries such as
libstruct_proto.a
should not be inputs to the build.What did you see instead?
These libraries are included and therefore can lead to duplicate symbols in the produced binary.
Possible fix
I believe we should revert the offending commits:
7b28278
a03d332
Until there is a clear fix upstream from bazel. Based on their original PRs I do not understand exactly what they were fixing though, so I assume that is not possible. Any other thoughts on how we could resolve this would be appreciated! It's possible we could go back to using a genrule for the
blacklisted_protos
while still keeping the other changes.The text was updated successfully, but these errors were encountered: