ci(cd): silence expected static-glibc linker warnings in prod build#376
Closed
passcod wants to merge 1 commit into
Closed
ci(cd): silence expected static-glibc linker warnings in prod build#376passcod wants to merge 1 commit into
passcod wants to merge 1 commit into
Conversation
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
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.
What
Silence the
linker_messageswarnings that appear all over the prod (cd.yml) build log by adding-A linker_messagesto the build'sRUSTFLAGS.Why
The prod build statically links glibc (
-C target-feature=+crt-static) so the binaries run in the minimalbusybox:glibcruntime image. glibc's NSS functions —getaddrinfo(DNS, used byreqwest/std::net) andgetpwuid_r(used bytokio-postgreson connect) —dlopenlibnss_*.soat runtime, so they can't be fully baked into a static binary.ldwarns about this, and rustc's warn-by-defaultlinker_messageslint 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-staticon glibc — not a code bug. It's benign in this deployment: thebusybox:glibcruntime image ships the matching glibc shared libs (including thelibnss_*modules), so resolution works at runtime. That's confirmed by prod already connecting to Postgres and resolving DNS today.Scope
The
-A linker_messagesallow is added to the exact sameRUSTFLAGSenv that carries+crt-static, so it only affects the prod release build. CI (ci.yml) and local/dev builds don't set+crt-staticand never emitted these warnings, so they're untouched.Alternative (not taken)
Switching the prod target to
aarch64-unknown-linux-muslwould eliminate the underlying condition (musl does true full static linking with no runtime NSSdlopen), 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