From e6e7dc5e320073efd25558209e060a395523d7a4 Mon Sep 17 00:00:00 2001 From: whispers Date: Fri, 3 Jul 2026 00:17:21 -0400 Subject: [PATCH] protobufc: unpin standard version to fix build with gcc 16 protobufc pins a specific version of the C++ standard and does so using an ancient vendored macro from the autoconf archive. this causes a failure to build on gcc 16, as it defaults to C++20 and protobufc uses C++17. this particularly causes problems with abseil, which has headers which depend on the C++ standard to compile. accordingly, to avoid having to manually specify and update a version each time the default standard version updates, we unpin it completely and allow the compiler to choose what it uses by default. alternatively, we could override the abseil that ends up in protobufc by way of protobuf_33 to use the C++17 standard instead. this would work, but this seems more fragile and subject to compiler version churn. it is also our understanding that mixing and matching versions of standards in dependents can be messy, and using the default seems the least likely to cause problems. --- pkgs/by-name/pr/protobufc/package.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/by-name/pr/protobufc/package.nix b/pkgs/by-name/pr/protobufc/package.nix index c71242bd98dd..8e3537d9a224 100644 --- a/pkgs/by-name/pr/protobufc/package.nix +++ b/pkgs/by-name/pr/protobufc/package.nix @@ -36,6 +36,21 @@ stdenv.mkDerivation (finalAttrs: { zlib ]; + # The upstream macro is vendored from a very old autoconf archive: + # https://github.com/protobuf-c/protobuf-c/commit/42612b4ba4b11d48b76e3643fa6d42f617e661b6 + # and the build system appears to arbitrarily require C++17 specifically: + # https://github.com/protobuf-c/protobuf-c/blob/4719fdd7760624388c2c5b9d6759eb6a47490626/configure.ac#L72 + # However, the default standard version used by GCC continues to increase + # (e.g. C++20 for GCC 16), and so protobuf-c's dependencies do as well. In + # particular, abseil-cpp has headers that protobuf-c includes and are + # sensitive to the standard version. While we could override the standard + # version used by these dependents, it is simpler to drop the requirement and + # allow the compiler default standard to be used. + postPatch = '' + substituteInPlace configure.ac --replace-fail \ + "AX_CXX_COMPILE_STDCXX(17, noext, mandatory)" "" + ''; + env.PROTOC = lib.getExe buildPackages.protobuf_33; meta = {