docs/superpowers/plans/2026-05-04-protobuf-vendor.md
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Vendor protobuf 3 into deps/ and make the mysqlx plugin link against it on Linux and macOS without depending on Homebrew or the system libprotobuf.
Architecture: Add a protobuf 3 source archive and a small deps/Makefile recipe that builds a static libprotobuf.a from that archive into a local deps/protobuf build tree. Then update plugins/mysqlx/Makefile so the plugin uses the vendored protobuf include and library paths unconditionally on both Linux and macOS, while keeping the existing generated *.pb.cc sources unchanged.
Tech Stack: GNU make, CMake, C++17, protobuf 3.21.12 source release.
Files:
Create: deps/protobuf/protobuf-3.21.12.tar.gz
Modify: deps/Makefile
Step 1: Add the protobuf source archive
Download https://github.com/protocolbuffers/protobuf/releases/download/v3.21.12/protobuf-3.21.12.tar.gz into deps/protobuf/.
Extend deps/Makefile with a protobuf target that extracts the archive and runs a CMake build for a static runtime library. The target should produce a stable artifact path that other makefiles can consume, such as deps/protobuf/protobuf-3.21.12/build/libprotobuf.a or a local install tree under deps/protobuf/install/.
Run: make -C deps protobuf -j24
Expected: protobuf 3.21.12 configures and builds a static runtime library without touching the mysqlx plugin yet.
git add deps/protobuf/protobuf-3.21.12.tar.gz deps/Makefile
git commit -m "Vendor protobuf 3 for mysqlx"
Files:
Modify: plugins/mysqlx/Makefile
Step 1: Update the mysqlx build inputs
Replace the pkg-config protobuf dependency check with explicit include/library paths that point at the vendored protobuf build or install tree from Task 1. Keep the existing PROTOBUF_GENERATED_VERSION := 3.21.12 guard so the build still fails if the archive is missing or the wrong protobuf tree is selected.
Run: make -C plugins/mysqlx PROXYSQL40=1 -j24
Expected: the plugin links successfully against the vendored libprotobuf.a.
Run the same make -C plugins/mysqlx PROXYSQL40=1 -j24 flow on macOS.
Expected: the build no longer depends on Homebrew protobuf@3 and does not trip the ABI guard.
git add plugins/mysqlx/Makefile
git commit -m "Link mysqlx against vendored protobuf"
Files:
None
Step 1: Rebuild the tree
Run:
export PROXYSQL40=1
make cleanall
make build_deps -j24
make debug -j24
make build_tap_test_debug -j24
Expected: the full Linux build passes with vendored protobuf and the mysqlx plugin still builds.
If the macOS build reveals any path or linker differences, adjust only the vendored protobuf wiring rather than reintroducing a system-protobuf dependency.
Record the exact commands and any residual warnings in the branch notes or PR description.