Skip to content

ci(cd): silence expected static-glibc linker warnings in prod build#376

Closed
passcod wants to merge 1 commit into
mainfrom
claude/linker-warnings-prod-89wflb
Closed

ci(cd): silence expected static-glibc linker warnings in prod build#376
passcod wants to merge 1 commit into
mainfrom
claude/linker-warnings-prod-89wflb

Conversation

@passcod

@passcod passcod commented Jul 19, 2026

Copy link
Copy Markdown
Member

What

Silence the linker_messages warnings that appear all over the prod (cd.yml) build log by adding -A linker_messages to the build's RUSTFLAGS.

Why

The prod build statically links glibc (-C target-feature=+crt-static) so the binaries run in the minimal busybox:glibc runtime image. glibc's NSS functions — getaddrinfo (DNS, used by reqwest/std::net) and getpwuid_r (used by tokio-postgres on connect) — dlopen libnss_*.so at runtime, so they can't be fully baked into a static binary. ld warns about this, and rustc's warn-by-default linker_messages lint surfaces it, producing 2 warnings per bin that touches DNS or Postgres (chrome_versions, backups, slacker_outbox, ownstatus, public-server, public-openapi-dump, …).

This is a known, upstream-by-design limitation of +crt-static on glibc — not a code bug. It's benign in this deployment: the busybox:glibc runtime image ships the matching glibc shared libs (including the libnss_* modules), so resolution works at runtime. That's confirmed by prod already connecting to Postgres and resolving DNS today.

Scope

The -A linker_messages allow is added to the exact same RUSTFLAGS env that carries +crt-static, so it only affects the prod release build. CI (ci.yml) and local/dev builds don't set +crt-static and never emitted these warnings, so they're untouched.

Alternative (not taken)

Switching the prod target to aarch64-unknown-linux-musl would eliminate the underlying condition (musl does true full static linking with no runtime NSS dlopen), making the warnings disappear at the source. That's a larger, higher-risk change (musl toolchain, crypto backends, new runtime base), so this PR takes the contained fix. Happy to pursue the musl route separately if a genuinely static binary is wanted.

🤖 Generated with Claude Code


Generated by Claude Code

The prod build statically links glibc (+crt-static) so the binaries run
in the minimal busybox:glibc image. glibc's NSS functions (getaddrinfo,
getpwuid_r) dlopen libnss_*.so at runtime and can't be fully statically
linked, so ld emits warnings that rustc surfaces via the linker_messages
lint. They're benign here — the runtime image ships the matching glibc
shared libs — so allow the lint to keep the build log clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DvcGxnCWP9XwG9MEA5ZEh3
@passcod passcod closed this Jul 19, 2026
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.

2 participants