Commit afdb05a
Fix the OSS Autotools build
Summary:
D113608290 broke the OSS GitHub build and D114285182 did not fix it. There were
several distinct problems, not one. Everything below was built and run in a real
Ubuntu 24.04 chroot rather than reasoned about.
**1. Automake rejects literal `-Wl,` tokens in `LDADD`.** That was the original
D113608290 failure. D114285182 hid them behind `$(FBTHRIFT_LINKER_DRIVER_FLAG)`,
which got past `autoreconf` but made things worse: Automake only expands a word
when the whole word is a `$(VAR)` reference, so it copied
`$(FBTHRIFT_LINKER_DRIVER_FLAG),--start-group` verbatim into
`mock_mc_server_DEPENDENCIES`, giving `No rule to make target
'-Wl,--start-group'`. Fixed by defining `FBTHRIFT_STATIC_LIBS` via `AC_SUBST`,
which is opaque to both the flag check and the dependency computation.
**2. libtool defeats the linker group anyway.** This is the part that makes the
whole D113608290 approach unworkable, independent of Automake syntax. libtool
hoists every `-Wl,` flag to the front of the command and de-duplicates repeated
`-l` flags:
```
automake passes: ... libmcrouter.a -Wl,--start-group -lthriftcpp2 ... -lcommon -Wl,--end-group -lfmt ...
libtool execs: ... -Wl,--start-group -Wl,--end-group -L... libmcrouter.a -lthriftcpp2 ... -lcommon ...
```
The group collapses to an empty pair. Because libtool also de-duplicates
(keeping the last occurrence), repeating libraries cannot resolve the cycle
either. Fixed with a `_LINK` override on the two affected programs so they are
linked by `$(CXXLD)` directly; the fbthrift archives are genuinely cyclic, so
the group is required.
**3. `-lthrift_path` was missing** from the closure. It defines
`apache::thrift::dynamic::detail::typeDisplayName`, used by
`libthrift_dynamic_value.a`.
**4. `Common_constants.cpp` and `Memcache_constants.cpp` are generated but were
never compiled.** They define the `_fbthrift_schema_*_includes()` symbols that
`*_data.cpp` references.
**5. `Server.cpp` was never compiled**, leaving
`mcrouter::detail::startServerShutdown` undefined in the `mcrouter` binary.
**6. `CarbonTest.thrift` was never compiled at all.** `lib/network/test/gen` had
no `Makefile.am` and no `AC_CONFIG_FILES` entry, so
`gen-cpp2/CarbonTest_types.h` never existed and every `mcrouter_network_test`
source failed to compile. Added a `Makefile.am` for that directory following the
`lib/network/gen` pattern, wired it into `SUBDIRS` and `AC_CONFIG_FILES`, and
added the generated sources to the test. Also corrected
`$(top_builddir)/lib/network/libtest_util.a` to `libtest_util.a` — that archive
is built in `lib/network/test`, not `lib/network`.
The top-level `mcrouter_LDADD` also carried its own stale copy of the fbthrift
list; it now shares `FBTHRIFT_STATIC_LIBS`.
**`make check` still does not work, and this diff does not claim to fix it.**
Item 6 fixes the compile step, but the OSS test wiring has independent rot:
`libtestmain.la`'s only source, `lib/TestMain.cpp`, does not exist anywhere in
the repo (7 test directories depend on it), and `MockMcServer.cpp` is listed in
`mcrouter_network_test_SOURCES` even though it defines its own `main()`, so the
test binary runs a mock server instead of gtest. Resurrecting `make check` is a
separate piece of work. CI runs `make`, not `make check`.
Reviewed By: anidev
Differential Revision: D114393734
fbshipit-source-id: e3f7c269c929e40995ba3b07a75244ef4a20ff0d1 parent 1f1e9f6 commit afdb05a
6 files changed
Lines changed: 73 additions & 43 deletions
File tree
- mcrouter
- lib
- network
- gen
- test
- gen
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
| 254 | + | |
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 258 | + | |
271 | 259 | | |
272 | 260 | | |
273 | 261 | | |
274 | 262 | | |
275 | | - | |
| 263 | + | |
276 | 264 | | |
277 | 265 | | |
278 | 266 | | |
279 | | - | |
| 267 | + | |
280 | 268 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
218 | 226 | | |
219 | 227 | | |
220 | 228 | | |
| 229 | + | |
221 | 230 | | |
222 | 231 | | |
223 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
| |||
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
| 233 | + | |
| 234 | + | |
231 | 235 | | |
232 | 236 | | |
233 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
| |||
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
51 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
52 | 60 | | |
53 | 61 | | |
54 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 12 | + | |
| 13 | + | |
33 | 14 | | |
34 | 15 | | |
35 | 16 | | |
36 | 17 | | |
37 | 18 | | |
38 | 19 | | |
39 | 20 | | |
| 21 | + | |
40 | 22 | | |
41 | 23 | | |
42 | 24 | | |
| |||
90 | 72 | | |
91 | 73 | | |
92 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
93 | 82 | | |
94 | 83 | | |
95 | 84 | | |
| |||
110 | 99 | | |
111 | 100 | | |
112 | 101 | | |
113 | | - | |
| 102 | + | |
114 | 103 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments