Skip to content

portability: fix build on Solaris/illumos (OmniOS)#42

Open
skirmess wants to merge 1 commit into
corosync:mainfrom
skirmess:omnios-portability
Open

portability: fix build on Solaris/illumos (OmniOS)#42
skirmess wants to merge 1 commit into
corosync:mainfrom
skirmess:omnios-portability

Conversation

@skirmess

@skirmess skirmess commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

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 in libsocket
and gethostbyname() in libnsl, rather than in libc as on Linux.
AC_SEARCH_LIBS is used so that no extra library is added on systems
where these functions are already in libc.

qdevices/utils.c: include config.h

AC_USE_SYSTEM_EXTENSIONS defines _POSIX_PTHREAD_SEMANTICS in
config.h, which selects the POSIX 5-argument form of getgrnam_r
on Solaris/illumos. Without including config.h, the compiler saw the
old 4-argument Solaris form instead, causing a build error.

qdevices/unix-socket.c: undef sun macro

GCC on Solaris/illumos predefines sun as a numeric macro (1) for
platform detection. This conflicted with the local variable sun of
type struct sockaddr_un, causing a syntax error. Adding #undef sun
after the system includes resolves the conflict while keeping the
established variable name.

Testing

Tested on OmniOS r151054 (--disable-qdevices, building corosync-qnetd)
and on Fedora 44 (full build including corosync-qdevice).

🤖 Generated with Claude Code

@knet-jenkins

knet-jenkins Bot commented Jun 6, 2026

Copy link
Copy Markdown

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>
@skirmess skirmess force-pushed the omnios-portability branch from 3a21e95 to ad97f0a Compare June 6, 2026 20:58
@knet-jenkins

knet-jenkins Bot commented Jun 6, 2026

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant