envoyproxy / envoyproxy/envoy

protobuf: the linker drops symbols under certain circumstances

Open
#9,639 1 comment 1 reaction 1 assignee Claimed by @junr03 View on GitHub
area/build help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
428

Description

*Description*:
With the v2 -> v3 api migration in Envoy there is a linking issue related to this [one](https://github.com/google/protobuf/issues/4221). Which as noted in #9191 still appears in some circumstances, and thus protobuf_link_hacks.h is still needed.

Symbols for v2 protos which headers are not included in any file in the codebase are being dropped by the linker in some circumstances (e.g, in the Envoy Mobile iOS build system). Even though all v2 packages are included as a dependency in their corresponding v3 package, and `always_link` is set for all proto bazel targets. Further proof of this can be seen by way of counter example with the `envoy.api.v2.Cluster` type, which is checked for by `proto_descriptors.cc`. This type **is** getting linked because its headers is still included in `cds_api_impl.cc`. On the other side because the v2 hds header is not included anywhere the v2 service type is getting dropped, and thus the descriptor is not present in the descriptor pool.

#9615 forces linking for some of these types. However, we should figure out what is going on with the linker, because long term as more v2 headers are removed we will be playing a game of whack-a-mole.

Note that this might be an issue with the Envoy Mobile iOS build system. However, I am filing the issue here in order to clean up the hacks put in place in Envoy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.