You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 320d024
Browse filesBrowse the repository at this point in the historyBrowse files
feat: add compat.re2 2022-04-01 + a upb feature on compat.protobuf (#148)
* feat: add compat.re2 2022-04-01 + a `upb` feature on compat.protobuf
The index-side half of gRPC's P1: with these, a future grpc-m adaptation
repo has to vendor only gRPC's own source.
Before writing either, the biggest unknown was settled by compiling gRPC
1.83.0 TUs directly with mcpp's gcc@16.1.0 — no patches, no configure, no
codegen, include paths only:
OK src/core/lib/slice/slice.cc
OK src/core/lib/surface/call.cc (one of core's heaviest)
OK src/core/lib/promise/activity.cc
OK src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c
OK src/cpp/common/channel_arguments.cc
OK src/cpp/client/channel_cc.cc (the C++ API layer)
and the SSL layer 4/4 against compat.openssl 3.5.1's headers rather than
BoringSSL. gRPC's tree also has no .h.in / config.h.cmake at all, confirming
it needs no configure step.
compat.re2 is pinned to 2022-04-01 because that IS gRPC 1.83.0's pin (its
third_party/re2 submodule is commit 0c5616d == that tag) and gRPC's xds
matchers are written against this API — RE2 swapped re2::StringPiece for
absl::string_view in its 2023 releases, so a newer one is not a drop-in.
Sources follow upstream's RE2_SOURCES: all of re2/*.cc (upstream keeps tests
one level down in re2/testing/) plus util/rune.cc and util/strutil.cc named
individually, because the other TUs in util/ define main() — a dependency's
objects all enter the consumer's link — and util/pcre.cc would drag in libpcre.
The `upb` feature needs no new download: upb has lived in protobuf's own
tarball since v22. Two things there are not guesswork:
* upb/**/*.c CANNOT be globbed. It pulls 14 extra files including TWO
ALTERNATIVE BUILDS of the descriptor tables (upb/reflection/stage0/ and
upb/reflection/cmake/); compiling more than one is a duplicate-symbol
failure. Hence a transcription of libupb_srcs (63 files).
* descriptor.upb_minitable.c must be added ON TOP of that list even though
it is not in it — upstream's cmake/libupb.cmake adds exactly that file as
bootstrap_sources, because the whole reflection layer reaches the
descriptor tables through upb/reflection/descriptor_bootstrap.h. Omitting
it compiles fine and fails only at link time.
include_dirs gains the tarball root and the bootstrap dir. Those are
unconditional because `features` can gate sources/defines/deps but NOT include
dirs, and the feature's own TUs need them; both are additive rather than
shadowing (the root supplies only upb/…, since protobuf's C++ headers live
under src/, and the bootstrap dir supplies google/protobuf/descriptor.upb*.h,
a different file name from the C++ descriptor.h beside it).
Verified cold with the pinned mcpp 2026.8.3.3, gcc@16.1.0,
MCPP_INDEX_MIRROR=GLOBAL, MCPP_BUILD_CACHE=local, target/ removed first:
abseil test result ok. 1 passed; 0 failed (17.84s)
protobuf test result ok. 1 passed; 0 failed (40.88s)
protobuf-gzip test result ok. 1 passed; 0 failed (51.99s)
protobuf-upb test result ok. 1 passed; 0 failed (70.20s)
re2 test result ok. 1 passed; 0 failed ( 2.35s)
The first three are regressions: this change touches compat.protobuf's
include_dirs, so the existing members had to be re-checked.
Object counts verified: re2 links 23 .o (22 sources + the test);
protobuf-upb links 296 = 151 abseil + 80 protobuf + 64 upb + 1 test. The upb
feature was verified negatively too — reverting the member to a bare
`protobuf = "35.1"` drops it to exactly 232 and fails the link with undefined
upb_Arena_Init / upb_Decode / upb_DefPool_Free AND
google__protobuf__FileDescriptorProto_msg_init, which is precisely the
bootstrap descriptor table the second bullet above is about.
The upb test drives BOTH runtimes over the same bytes: the C++ runtime builds
and serializes a FileDescriptorProto, then upb parses it, loads it into a
upb_DefPool and answers reflection queries — and asserts that a name never
declared does NOT resolve.
CN mirror published and closed-loop checked: mcpp-res/re2@2022-04-01 returns
http=200 and is byte-identical to GLOBAL.
* fix(re2): define NOMINMAX on windows — <windows.h> ate Regexp::min()/max()
CI's windows leg failed with
re2/regexp.cc:389: error: too few arguments provided to function-like macro invocation
re2/regexp.cc:389: error: reference to non-static member function must be called
which is not the usual std::min/std::max collision. RE2's util/mutex.h includes
<windows.h>, and its min/max function-like macros then eat RE2's OWN accessors:
regexp.cc compares `a->min() == b->min()` and `a->max() == b->max()` on Regexp.
Upstream's CMake never spells NOMINMAX out because a CMake consumer normally
sets it project-wide; in the index each package carries its own flags.
linux re-verified (test result ok); the windows path is only checkable in CI.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Two kinds of packages live here:
39
39
|------|------|
40
40
| Native module library (Form A) |[`mcpplibs.xpkg`](pkgs/x/xpkg.lua) · [`mcpplibs.tinyhttps`](pkgs/t/tinyhttps.lua) · [`tensorvia-cpu`](pkgs/t/tensorvia-cpu.lua) · [`ffmpeg`](pkgs/f/ffmpeg.lua) (module layer; sources compiled directly through `compat.ffmpeg`) · [`opencv`](pkgs/o/opencv.lua) (single repository: the module layer and the full OpenCV 5 source build both live in the package, and only this descriptor stays on the index side) |
| C++-source compat, one depending on the other |[`compat.abseil`](pkgs/c/compat.abseil.lua) (151 TUs; a wildcard over `absl/**` trimmed by upstream's test/benchmark naming conventions) · [`compat.protobuf`](pkgs/c/compat.protobuf.lua) (the libprotobuf runtime, 79 TUs transcribed from upstream's own `src/file_lists.cmake`; declares `compat.abseil` as a dependency because protobuf's public headers include `absl/…`, and its `gzip` feature defines `HAVE_ZLIB` and pulls `compat.zlib`) |
42
+
| C++-source compat, one depending on the other |[`compat.abseil`](pkgs/c/compat.abseil.lua) (151 TUs; a wildcard over `absl/**` trimmed by upstream's test/benchmark naming conventions) · [`compat.protobuf`](pkgs/c/compat.protobuf.lua) (the libprotobuf runtime, 79 TUs transcribed from upstream's own `src/file_lists.cmake`; declares `compat.abseil` as a dependency because protobuf's public headers include `absl/…`, and its `gzip` feature defines `HAVE_ZLIB` and pulls `compat.zlib`, while `upb` adds protobuf's 64-TU C runtime out of the same tarball) · [`compat.re2`](pkgs/c/compat.re2.lua) (22 TUs, upstream's own `RE2_SOURCES`) |
| Runtime loader compat (pure sources, sidestepping upstream codegen/asm) |[`compat.vulkan`](pkgs/c/compat.vulkan.lua) (the Khronos loader: `loader/generated/` is checked in, and the assembly path degrades to plain C through `UNKNOWN_FUNCTIONS_SUPPORTED`, so no CMake/Python/assembler is needed; windows deferred) · [`compat.vulkan-headers`](pkgs/c/compat.vulkan-headers.lua)|
45
45
| Whole-source direct build + generated config (only where a platform lacks one) |[`compat.curl`](pkgs/c/compat.curl.lua) (win32 uses upstream's checked-in config, unix generates one) · [`compat.sdl2`](pkgs/c/compat.sdl2.lua) (win/mac use upstream's checked-in config; linux generates one and enables X11 by hand) |
0 commit comments