protozero fails to build with devel/protobuf >= 3.19 because it builds
with -pedantic -std=c++11 -Werror and because newer protobuf has this

#if __has_cpp_attribute(nodiscard)
#define PROTOBUF_NODISCARD [[nodiscard]]
...

For some reason, __has_cpp_attribute(nodiscard) is true even with
-std=c++11, which then leads to this warning/error:

test/t/bytes/bytes_testcase.pb.h:190:3: error: use of the 'nodiscard' attribute 
is a C++17 exte
nsion [-Werror,-Wc++17-extensions]

A similar issue was reported e.g., here:
https://github.com/nlohmann/json/issues/1535

With the workaround below, the three ports dependent on devel/protozero

geo/libosmium
geo/osm2pgsql
geo/osrm-backend

build fine with protobuf 3.19.1.

I can also send an update to protozero 1.7.0 if there is interest.

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/protozero/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- Makefile    12 Jul 2019 20:45:16 -0000      1.4
+++ Makefile    2 Nov 2021 19:27:28 -0000
@@ -14,6 +14,8 @@ PERMIT_PACKAGE =      Yes
 
 COMPILER =     base-clang ports-gcc ports-clang
 
+CONFIGURE_ARGS = -DWERROR=NO
+
 MODULES =      devel/cmake
 BUILD_DEPENDS =        devel/protobuf
 

Reply via email to