https://github.com/protocolbuffers/protobuf/issues/20299

--- protobuf-24.4/src/google/protobuf/port_def.inc.orig
+++ protobuf-24.4/src/google/protobuf/port_def.inc
@@ -1020,6 +1020,12 @@
 #undef TYPE_BOOL
 #endif  // __APPLE__
 
+#ifdef __illumos__
+// Inconvenient macro name from /usr/include/limits.h.
+#pragma push_macro("UID_MAX")
+#undef UID_MAX
+#endif  // __illumos__
+
 #if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
 // Don't let Objective-C Macros interfere with proto identifiers with the same
 // name.
--- protobuf-24.4/src/google/protobuf/port_undef.inc.orig
+++ protobuf-24.4/src/google/protobuf/port_undef.inc
@@ -184,6 +184,10 @@
 #pragma pop_macro("TYPE_BOOL")
 #endif  // __APPLE__
 
+#ifdef __illumos__
+#pragma pop_macro("UID_MAX")
+#endif  // __illumos__
+
 #if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
 #pragma pop_macro("DEBUG")
 #endif // defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)