error: In the GNU C Library, "major" is defined
error: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. [-Werror] 1182 | ::PROTOBUF_NAMESPACE_ID::uint32 major() const; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. [-Werror] 1191 | ::PROTOBUF_NAMESPACE_ID::uint32 minor() const; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please add more context:
- OS you're using to build on
- C/C++ compiler type and version
gcc (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) Target: x86_64-pc-linux-gnu
We've experienced issues before with gcc < 10.x (not this particular one to my memory though). Any chance you can upgrade gcc to >= 10.3 ?
I have tried with GCC 10 and 11 Clang 14
But didn't worked getting errors
error: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. [-Werror] 1182 | ::PROTOBUF_NAMESPACE_ID::uint32 major() const; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. [-Werror] 1191 | ::PROTOBUF_NAMESPACE_ID::uint32 minor() const; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I also get those errors when using gcc 11.3 in aarch64 to complier silkworm.
Seems above code will help you to avoid these errors but the errors still exist.
diff --git a/interfaces/types/types.pb.h b/interfaces/types/types.pb.h
index 563f48a..306bd99 100644
--- a/interfaces/types/types.pb.h
+++ b/interfaces/types/types.pb.h
@@ -19,6 +19,13 @@
#error regenerate this file with a newer version of protoc.
#endif
+#ifdef major
+#undef major
+#endif
+#ifdef minor
+#undef minor
+#endif
+
#include <google/protobuf/port_undef.inc>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/arena.h>
diff --git a/third_party/silkpre b/third_party/silkpre
--- a/third_party/silkpre
+++ b/third_party/silkpre
By the way, The most thorough way is to change the major, minor and patch field in type proto.