You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the version.proto message, protoc generates a C++ class that defines int32_t major() const and int32_t minor() const member methods.
It happens that - at least on NetBSD - major(3) and minor(3) are macros defined in sys/types.h and the protoc generated code does not compile due to the macros exanding in the wrong context. These macros can be disabled from system headers by defining e.g. _POSIX_C_SOURCE at compile time, but defining this might have other unwanted side effects regarding system headers. It is also cumbersome to propagate this option to every single software that needs to include the message definitions.
On the NetBSD side, it will be very hard (not to say impossible) to change/rename these macros (as it was done e.g. on Linux) because they've always been there and the chances to break something somewhere are high.
My current workaround is to patch gz/msgs/convert/FuelMetadata.hh and the generated MessageTypes.hh by adding in the preambule before anything:
#include <sys/types.h>
#undef major
#undef minor
This is a bit fragile, and does not fix any code willing to include the messages directly.
So while noone is to blame really in this case, I was wondering whether it could possibly be envisaged to name those members a bit differently, like major_number or vmajor or anything not conflicting with system headers. I know this will break compatibility, but I was thinking that maybe this message is not widely used (only from fuel_metadata.proto from what I have seen so far) so it might not actually be that bad as a breaking change.
Any thoughts?
The text was updated successfully, but these errors were encountered:
Thanks for reporting it, we'll discuss it in the next Gazebo PMC meeting.
We could add a new version message Version2.proto with the renamed parameters in it. Then, replace all Gazebo code using Version with Version2 and that should preserve ABI. If we come up with a good name for the new Version proto file we'll just need to deprecate/remove the original Version.proto in future releases.
If Version2 is just a workaround, we might need to also add extra fields to Version.proto and ending up removing the workaround Version2.proto and the major and minor fields in Version.proto.
Environment
Description
From the version.proto message, protoc generates a C++ class that defines
int32_t major() const
andint32_t minor() const
member methods.It happens that - at least on NetBSD -
major(3)
andminor(3)
are macros defined insys/types.h
and the protoc generated code does not compile due to the macros exanding in the wrong context. These macros can be disabled from system headers by defining e.g. _POSIX_C_SOURCE at compile time, but defining this might have other unwanted side effects regarding system headers. It is also cumbersome to propagate this option to every single software that needs to include the message definitions.On the NetBSD side, it will be very hard (not to say impossible) to change/rename these macros (as it was done e.g. on Linux) because they've always been there and the chances to break something somewhere are high.
My current workaround is to patch
gz/msgs/convert/FuelMetadata.hh
and the generatedMessageTypes.hh
by adding in the preambule before anything:This is a bit fragile, and does not fix any code willing to include the messages directly.
So while noone is to blame really in this case, I was wondering whether it could possibly be envisaged to name those members a bit differently, like
major_number
orvmajor
or anything not conflicting with system headers. I know this will break compatibility, but I was thinking that maybe this message is not widely used (only fromfuel_metadata.proto
from what I have seen so far) so it might not actually be that bad as a breaking change.Any thoughts?
The text was updated successfully, but these errors were encountered: