Build Fails on Alma Linux #26

Closed
opened 2026-07-06 13:31:22 +01:00 by danny · 7 comments
danny commented 2026-07-06 13:31:22 +01:00 (Migrated from gitlab.keyop.co.uk)

Owing to an issue in msteinert/pam, the build will fail on Alma Linux. The builds from the CI releases will still work though.

The issue is described in https://github.com/msteinert/pam/issues/34, and the proposed and approved fix there would fix the problem.

Owing to an issue in `msteinert/pam`, the build will fail on Alma Linux. The builds from the CI releases will still work though. The issue is described in https://github.com/msteinert/pam/issues/34, and the proposed and approved fix there would fix the problem.
danny commented 2026-07-06 13:32:18 +01:00 (Migrated from gitlab.keyop.co.uk)

changed the description

changed the description
claude commented 2026-07-08 16:33:23 +01:00 (Migrated from gitlab.keyop.co.uk)

Root cause confirmed and fix verified against a real AlmaLinux 8.10 container (not just reasoned about):

msteinert/pam/v2's cgo preamble includes <dlfcn.h> and references C.RTLD_NEXT under -std=c99. RTLD_NEXT is gated behind glibc's #ifdef __USE_GNU in that header - without _GNU_SOURCE defined, glibc 2.28 (RHEL/Alma 8's version) does not expose it under strict c99, and the build fails with exactly the reported error ("could not determine what C.RTLD_NEXT refers to"). Debian's glibc doesn't hit this, which is why CI/the packaged release binaries (built in the Debian-based golang-ci image) already work - only a local build actually run on such a host fails, matching this ticket's description exactly.

Reproduced the failure against a real almalinux:8.10 container, then confirmed CGO_CFLAGS=-D_GNU_SOURCE fixes it (both a minimal repro and the full project build with go build ./...).

Fix: export CGO_CFLAGS = -D_GNU_SOURCE in the Makefile (alongside the existing CGO_LDFLAGS_ALLOW export for libcap) - applies to make build/test/lint/package/release/coverage automatically, and is harmless on distros that don't need it. Upstream has an approved-but-unmerged fix (msteinert/pam#34); this workaround can be dropped once that lands and the dependency is bumped.

Root cause confirmed and fix verified against a real AlmaLinux 8.10 container (not just reasoned about): `msteinert/pam/v2`'s cgo preamble includes `<dlfcn.h>` and references `C.RTLD_NEXT` under `-std=c99`. RTLD_NEXT is gated behind glibc's `#ifdef __USE_GNU` in that header - without `_GNU_SOURCE` defined, glibc 2.28 (RHEL/Alma 8's version) does not expose it under strict c99, and the build fails with exactly the reported error ("could not determine what C.RTLD_NEXT refers to"). Debian's glibc doesn't hit this, which is why CI/the packaged release binaries (built in the Debian-based golang-ci image) already work - only a local build actually run on such a host fails, matching this ticket's description exactly. Reproduced the failure against a real `almalinux:8.10` container, then confirmed `CGO_CFLAGS=-D_GNU_SOURCE` fixes it (both a minimal repro and the full project build with `go build ./...`). Fix: `export CGO_CFLAGS = -D_GNU_SOURCE` in the Makefile (alongside the existing `CGO_LDFLAGS_ALLOW` export for libcap) - applies to `make build`/`test`/`lint`/`package`/`release`/`coverage` automatically, and is harmless on distros that don't need it. Upstream has an approved-but-unmerged fix (msteinert/pam#34); this workaround can be dropped once that lands and the dependency is bumped.
claude commented 2026-07-08 16:36:03 +01:00 (Migrated from gitlab.keyop.co.uk)

mentioned in commit 26bc72113d

mentioned in commit 26bc72113d713c0b1101cd27479ab764a611e2b8
claude commented 2026-07-08 16:36:15 +01:00 (Migrated from gitlab.keyop.co.uk)

mentioned in merge request !78

mentioned in merge request !78
danny commented 2026-07-08 19:00:47 +01:00 (Migrated from gitlab.keyop.co.uk)

mentioned in commit e701ff5e0c

mentioned in commit e701ff5e0c60cf5c52b19769359a674b9176aa77
danny (Migrated from gitlab.keyop.co.uk) closed this issue 2026-07-08 19:00:48 +01:00
claude commented 2026-07-08 19:08:42 +01:00 (Migrated from gitlab.keyop.co.uk)

mentioned in commit 6c88be75e0

mentioned in commit 6c88be75e0f996b0ffe54670834541f629fc841d
claude commented 2026-07-08 19:09:46 +01:00 (Migrated from gitlab.keyop.co.uk)

Merged via !78 (merge commit e701ff5).

This only affects local compilation (a Makefile CGO_CFLAGS export) - the packaged release binaries were already unaffected (built in the Debian-based golang-ci image, which never hit this), so I'd suggest this doesn't need a version tag either. Let me know if you'd like one anyway.

Merged via !78 (merge commit `e701ff5`). This only affects local compilation (a Makefile `CGO_CFLAGS` export) - the packaged release binaries were already unaffected (built in the Debian-based golang-ci image, which never hit this), so I'd suggest this doesn't need a version tag either. Let me know if you'd like one anyway.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
keyop-go/nfq_forwarder#26
No description provided.