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
compat.protobuf shipped the libprotobuf runtime and nothing else, so a
consumer that needed generated code had to find a protoc somewhere and
guarantee by hand that it matched the runtime being linked. That mismatch is
a RUNTIME failure — the classic protobuf footgun — and it is the whole reason
Conan carries a `protobuf/<host_version>` placeholder and xmake deletes protoc
outright when cross-compiling.
mcpp 2026.8.5.1 makes it inexpressible: a `kind = "bin"` target in the
descriptor, asked for by the consumer as `tools = ["protoc"]`, is built for
the BUILD machine out of the same package the consumer links. The tool's
version IS the dependency's version, and `--target` does not change that
because a code generator has to run here.
- pkgs/c/compat.protobuf.lua: add the `protoc` target
(main = "*/src/google/protobuf/compiler/main.cc") plus a `protoc` feature
carrying the 138 entries of upstream's own `libprotoc_srcs` from
src/file_lists.cmake — zero overlap with the libprotobuf source set, and no
configure step (the tree holds no .h.in/.cmake.in). The target declares
required_features = { "protoc", "upb" }: libprotoc's upb generator links the
upb runtime, and without it the link fails on missing `upb_*` symbols, so
the descriptor states the constraint instead of leaving consumers to
discover it. Consumers who only link the runtime compile none of this.
- tests/examples/protobuf-protoc: the complement of tests/examples/protobuf.
That member deliberately uses NO generated code; this one is generated code
end to end — nested messages, enum, repeated field, map, oneof, a
well-known-type import and reflection over the generated pool, serialized
and parsed back. Verified locally: the four files this toolchain generates
for grpc-m's helloworld.proto are BYTE-IDENTICAL to the officially generated
stubs checked into that repo.
- CI pin -> 2026.8.5.1. This is a floor, not a routine bump: `tools = [...]`
does not parse before it ("tools must be a string, inline dep table, or
nested table"), confirmed against 2026.8.3.3.
- index.toml: min_mcpp deliberately UNCHANGED. It is a gate — an older client
failing it cannot open the index at all (mcpp#349) — and this change does
not make any descriptor unreadable: 2026.8.3.3 still parses compat.protobuf
with an empty unknown_keys. Only the consumer spelling needs the newer mcpp,
and that lives in a consumer's own mcpp.toml. latest_mcpp, an advisory hint
with no gate behaviour, tracks what CI validates against.
- docs: shape H (host tool provider) in package-types.md + zh, README rows.
Includes the one sharp edge: protoc does not embed the well-known types, so
`import "google/protobuf/timestamp.proto"` needs an -I derived from
mcpp::dep_dir("protobuf").
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) · [`mcpplibs.grpc`](pkgs/g/grpc.lua) (gRPC 1.83.0 — the one library here that CANNOT be a compat descriptor: upstream publishes no self-contained source artifact, its tag archive carrying abseil/protobuf/re2/boringssl/zlib as empty submodule placeholders, so [grpc-m](https://github.com/mcpplibs/grpc-m)'s release tarball IS that artifact. It vendors only gRPC's own source and takes the five dependencies from this index, so a consumer that also uses protobuf links one copy rather than two) |
| 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`) |
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. It also exposes **`protoc`** as a `kind = "bin"` target, so a consumer writing `tools = ["protoc"]` gets the compiler built for its own machine out of the same package it links — making a generator/runtime version mismatch inexpressible) · [`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) · [`compat.c-ares`](pkgs/c/compat.c-ares.lua) (91 TUs; the release tarball already ships `ares_build.h` and a Windows config, so only `ares_config.h` is snapshotted per OS) |
Copy file name to clipboardExpand all lines: docs/package-types.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ combined as needed.
18
18
|**E. Whole-source direct build with a generated config**| upstream generates its config header through configure/CMake; here a snapshot of it lands in `generated_files`|`pkgs/c/compat.libpng.lua`, `compat.curl.lua`, `compat.sdl2.lua`, `compat.ffmpeg.lua`|`generated_files` + `include_dirs`|
19
19
|**F. Shared-library compat**| has to be the **only** copy of that `.so` in the process (third parties `dlopen` it) | the X11 family such as `pkgs/c/compat.x11.lua`, and `compat.vulkan.lua` (linux) |`targets = { kind = "shared", soname = … }`|
20
20
|**G. Host runtime adaptation**| things that cannot be vendored, such as drivers — only a symlink farm plus metadata |`pkgs/c/compat.glx-runtime.lua`, `compat.vulkan-runtime.lua`|`runtime.library_dirs` / `capabilities`|
21
+
|**H. Host tool provider**| the upstream tarball also holds a **code generator** consumers run at build time |`pkgs/c/compat.protobuf.lua` (`protoc`) | a `targets` entry with `kind = "bin"` + `main`, plus `required_features`|
21
22
22
23
For the complete sample index, see the
23
24
[Reference examples table in the root README](../README.md#reference-examples-lua-descriptors).
@@ -200,6 +201,50 @@ Two details that keep biting:
200
201
-**The closure has to be complete.** A farm holding `libxcb.so.1` but not the `libXau.so.6` it depends on shadows the
201
202
host copy that would otherwise have resolved, and the executable simply fails to start.
202
203
204
+
## H. Host tool provider (`compat.protobuf`'s `protoc`)
205
+
206
+
Some tarballs hold both a library and the code generator that emits code against it. Declare the generator as a second
207
+
target, and consumers ask for it with `tools = [...]` (mcpp 2026.8.5.1+):
0 commit comments