Fix compilation error on GNU Hurd architectures
The MAXTHREADNAMESIZE macro is not (yet?) defined for builds on GNU Hurd, so the ddsrt_thead_getname() function cannot rely on it.
Thanks @roehling, the changes look fine to me, but I think it makes sense to wait until you tell me you have it building on GNU Hurd before merging this. Do you agree with that?
Yes, that is a good idea. The buildd for hurd-i386 seems quite busy at the moment, but I hope it will be done in a few hours. I'll let you know once it is done.
The build still fails on hurd-i386, and I don't have the time to hunt down the problem immediately, so I'll turn this into a draft and mark it ready for review once I sorted everything out.
@roehling sounds good. I'm somewhat surprised it turns out to be so hard to build: I always thought we had managed to have a really small footprint in terms of OS-specific things. But it seems Hurd is making things more complicated ...
Feel free to share error messages if you think it useful.
The Hurd developers are very opinionated about the PATH_MAX macro, meaning they don't like it and do not provide it. I thought FILENAME_MAX was mandated by some standard, but apparently it does not work out-of-the-box. I need to check if I can fix it with a simple #include <stdio.h>, otherwise an arbitrary constant (such as the Linux value 1024) will have to do.
The Debian build logs are here in case you want to take a look for yourself: https://buildd.debian.org/status/package.php?p=cyclonedds
#include <stdio.h> has helped with FILENAME_MAX; but now I'm stuck on a different error:
/home/roehling/cyclonedds/src/core/ddsi/src/ddsi_udp.c: In function ‘joinleave_ssm_mcgroup’:
/home/roehling/cyclonedds/src/core/ddsi/src/ddsi_udp.c:649:57: error: ‘MCAST_JOIN_SOURCE_GROUP’ undeclared (first use in this function)
649 | rc = ddsrt_setsockopt (socket, IPPROTO_IPV6, join ? MCAST_JOIN_SOURCE_GROUP : MCAST_LEAVE_SOURCE_GROUP, &gsr, sizeof (gsr));
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/roehling/cyclonedds/src/core/ddsi/src/ddsi_udp.c:649:57: note: each undeclared identifier is reported only once for each function it appears in
/home/roehling/cyclonedds/src/core/ddsi/src/ddsi_udp.c:649:83: error: ‘MCAST_LEAVE_SOURCE_GROUP’ undeclared (first use in this function)
649 | rc = ddsrt_setsockopt (socket, IPPROTO_IPV6, join ? MCAST_JOIN_SOURCE_GROUP : MCAST_LEAVE_SOURCE_GROUP, &gsr, sizeof (gsr));
| ^~~~~~~~~~~~~~~~~~~~~~~~
/home/roehling/cyclonedds/src/core/ddsi/src/ddsi_udp.c:662:55: error: ‘IP_ADD_SOURCE_MEMBERSHIP’ undeclared (first use in this function); did you mean ‘IP_ADD_MEMBERSHIP’?
662 | rc = ddsrt_setsockopt (socket, IPPROTO_IP, join ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP, &mreq, sizeof (mreq));
| ^~~~~~~~~~~~~~~~~~~~~~~~
| IP_ADD_MEMBERSHIP
/home/roehling/cyclonedds/src/core/ddsi/src/ddsi_udp.c:662:82: error: ‘IP_DROP_SOURCE_MEMBERSHIP’ undeclared (first use in this function); did you mean ‘IP_DROP_MEMBERSHIP’?
662 | rc = ddsrt_setsockopt (socket, IPPROTO_IP, join ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP, &mreq, sizeof (mreq));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| IP_DROP_MEMBERSHIP
src/core/CMakeFiles/ddsc.dir/build.make:138: recipe for target 'src/core/CMakeFiles/ddsc.dir/ddsi/src/ddsi_udp.c.o' failed
I did a bit of superficial googling, but I could not come up with an obvious fix, and I could not find the missing identifiers by grepping /usr/include on a GNU Hurd machine.
Hey @roehling, Just pinging you while I clean out the dust from the PR closet. Fixing builds for specific architectures is always nice, so if it is still relevant I'd like to get it to work. Since I (and probably all others working daily on CycloneDDS) do not have access to a GNU Hurd machine it is up to you to close this or ready the PR.
I haven't checked on this in a while, but as it turns out, Debian GNU Hurd has had a libc update that added the missing multicast macro definitions, so the PR builds just fine on hurd-i386 now. Feel free to merge.
EDIT As it actually turns out, setting -DENABLE_SOURCE_SPECIFIC_MULTICAST=OFF in combination with the PR fixes the build on GNU Hurd.
Just re-ran the test (shame they ran with the old pipeline definitions but okay https://dev.azure.com/eclipse-cyclonedds/cyclonedds/_build/results?buildId=3430&view=results) and everything seems fine. I'll merge this now! @roehling you could contribute a guide to docs/dev/gnu-hurd.rst similar to docs/dev/freertos.md with build instructions if you feel like it is warranted.