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

--- protobuf-30.2/src/google/protobuf/port_def.inc.orig
+++ protobuf-30.2/src/google/protobuf/port_def.inc
@@ -739,6 +739,12 @@
 #undef GID_MAX
 #endif  // __FreeBSD__
 
+#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-30.2/src/google/protobuf/port_undef.inc.orig
+++ protobuf-30.2/src/google/protobuf/port_undef.inc
@@ -163,6 +163,10 @@
 #pragma pop_macro("GID_MAX")
 #endif  // __FreeBSD__
 
+#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)