Commit 5d50e84
committed
[bp/1.37] Don't use sysroot when building using non-hermetic toolchain (#43681)
Commit Message:
Currently, even when using non-hermetic toolchain we in a few places use
Envoy sysroot. Depending on the environment you use when building it can
cause linking issues.
The problem is that sysroot contains a libc library, while libc++ comes
with the toolchain. If libc++ coming with the toolchain was built
against a different version of libc than the one we have in Envoy
sysroot, libc++ may contain references to the symbols that do not exist
in the libc that we have in Envoy sysroot - that results in linking
failures.
In practice it affects systems that use libc version much newere than
what we have in Envoy sysroot. The newer version of libc exposes more
functions and libc++, when linked againt it, takes advantage of those
newer symbols. As a result, when you combine libc++ linked against a
newer version of libc and older version of libc you get linking issues
due to a bunch of undefined symbols that libc++ uses.
Envoy sysroot currently supports libc version 2.31 (the default) and
2.28 (which seem to only exist for Istio, because Istio intentionally
wants to use as old version of libc as practical, because it needs to
distribute Envoy binaries that will run outside of container
environments and using a very old version of libc makes it easier).
glibc 2.31 is 6 years old at this point, so many distribution (both
popular like Ubuntu and more rare like Azure Linux) moved on to newer
versions of glibc.
There are a few ways we can handle this situation:
1. We can add more sysroot versions with newer versions of libc - given
that we don't test non-hermetic toolchain builts and different versions
of sysroot on CI, I think it's better to not place the burden of
supporting different sysroots on the community.
2. We can add libc++ to the sysroot - I didn't test it, but I'd imagine
it's possible to make it work, but because hermetic toolchain already
comes with libc++ linked against an old enough version of libc to not
cause problems, that will introduce some duplication (both sysroot and
toolchain will have a version of libc++ libraries)
3. We can say that non-hermetic builds for Envoy just aren't supported
at all - that's undesirable, because LLVM toolchains on GitHub are only
available for a few operating systems (Ubuntu, RedHat) and if you're not
using any of those, you are out of luck.
4. When not using hermetic toolchain, just don't provide sysroot and let
the host toolchain figure out how and where to find the libraries in the
host.
The option 4 makes most sense to me, so this PR implements that, but we
can discuss other options as well.
Additional Description:
It would be nice to cherry pick this to 1.37 release branch as well,
that is if we aggree that this approach makes sense.
Risk Level: low
Testing: I did test builds both with hermetic toolchain and with host
toolchain for both FIPS and non-FIPS builds to verify that the changes
work. And CI run regular tests with hermetic toolchain.
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a
---------
Signed-off-by: Mikhail Krinkin <mkrinkin@microsoft.com>1 parent 31896c5 commit 5d50e84
3 files changed
Lines changed: 94 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
10 | 16 | | |
11 | 17 | | |
12 | | - | |
13 | | - | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | | - | |
16 | | - | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | | - | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
| |||
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
66 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
68 | 80 | | |
69 | | - | |
70 | | - | |
| 81 | + | |
| 82 | + | |
71 | 83 | | |
72 | | - | |
73 | | - | |
| 84 | + | |
| 85 | + | |
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
| |||
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
85 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
86 | 101 | | |
87 | 102 | | |
| 103 | + | |
| 104 | + | |
88 | 105 | | |
89 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
90 | 115 | | |
91 | | - | |
| 116 | + | |
92 | 117 | | |
93 | 118 | | |
94 | 119 | | |
95 | | - | |
| 120 | + | |
96 | 121 | | |
97 | | - | |
| 122 | + | |
98 | 123 | | |
99 | | - | |
| 124 | + | |
100 | 125 | | |
101 | 126 | | |
102 | 127 | | |
| |||
105 | 130 | | |
106 | 131 | | |
107 | 132 | | |
108 | | - | |
| 133 | + | |
109 | 134 | | |
110 | 135 | | |
111 | 136 | | |
| 137 | + | |
112 | 138 | | |
113 | 139 | | |
114 | 140 | | |
| 141 | + | |
115 | 142 | | |
116 | 143 | | |
117 | | - | |
| 144 | + | |
118 | 145 | | |
119 | | - | |
| 146 | + | |
120 | 147 | | |
121 | | - | |
| 148 | + | |
122 | 149 | | |
123 | 150 | | |
124 | 151 | | |
125 | 152 | | |
126 | 153 | | |
127 | 154 | | |
128 | | - | |
| 155 | + | |
129 | 156 | | |
130 | 157 | | |
131 | 158 | | |
| 159 | + | |
132 | 160 | | |
133 | 161 | | |
134 | 162 | | |
| 163 | + | |
135 | 164 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
97 | 109 | | |
98 | 110 | | |
99 | 111 | | |
| |||
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
124 | 164 | | |
125 | 165 | | |
126 | 166 | | |
| |||
253 | 293 | | |
254 | 294 | | |
255 | 295 | | |
256 | | - | |
| 296 | + | |
257 | 297 | | |
258 | 298 | | |
259 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
0 commit comments