portability: fix build on Solaris/illumos (OmniOS)#42
Open
skirmess wants to merge 1 commit into
Open
Conversation
|
Can one of the project admins check and authorise this run please: https://haci.fast.eng.rdu2.dc.redhat.com/job/corosync-qdevice/job/corosync-qdevice-pipeline/job/PR-42/1/input |
Five issues prevented building on Solaris/illumos: - configure.ac: add AC_SEARCH_LIBS for socket and gethostbyname. On Solaris/illumos these functions are in libsocket and libnsl rather than libc. - configure.ac: test whether groff can actually produce HTML output before enabling HTML man page generation. On systems where groff is installed without the grohtml driver, the build would fail when trying to generate HTML man pages. - qdevices/utils.c: include config.h so that AC_USE_SYSTEM_EXTENSIONS takes effect. Without it, _POSIX_PTHREAD_SEMANTICS is not defined and the compiler sees the old 4-argument Solaris form of getgrnam_r instead of the POSIX 5-argument form. - qdevices/unix-socket.c: add '#undef sun' after the system includes. GCC on Solaris/illumos predefines 'sun' as a numeric macro for platform detection, which conflicts with the local variable of the same name used for struct sockaddr_un. - qdevices/tlv.c: include <endian.h> on Solaris/illumos for htobe64() and be64toh(). Solaris/illumos provides these functions in <endian.h>, the same header as Linux. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3a21e95 to
ad97f0a
Compare
|
Can one of the project admins check and authorise this run please: https://haci.fast.eng.rdu2.dc.redhat.com/job/corosync-qdevice/job/corosync-qdevice-pipeline/job/PR-42/2/input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building on Solaris/illumos (tested on OmniOS r151054) failed with three
distinct issues.
Fixes
configure.ac: link against libsocket and libnsl
On Solaris/illumos,
socket()and related functions live inlibsocketand
gethostbyname()inlibnsl, rather than in libc as on Linux.AC_SEARCH_LIBSis used so that no extra library is added on systemswhere these functions are already in libc.
qdevices/utils.c: include config.h
AC_USE_SYSTEM_EXTENSIONSdefines_POSIX_PTHREAD_SEMANTICSinconfig.h, which selects the POSIX 5-argument form ofgetgrnam_ron Solaris/illumos. Without including
config.h, the compiler saw theold 4-argument Solaris form instead, causing a build error.
qdevices/unix-socket.c: undef sun macro
GCC on Solaris/illumos predefines
sunas a numeric macro (1) forplatform detection. This conflicted with the local variable
sunoftype
struct sockaddr_un, causing a syntax error. Adding#undef sunafter the system includes resolves the conflict while keeping the
established variable name.
Testing
Tested on OmniOS r151054 (
--disable-qdevices, buildingcorosync-qnetd)and on Fedora 44 (full build including
corosync-qdevice).🤖 Generated with Claude Code