fix(nix): resolve ncurses cfgetospeed via dlvsym to keep portable bundle on older glibc - #2341
Draft
brainrake wants to merge 3 commits into
Draft
fix(nix): resolve ncurses cfgetospeed via dlvsym to keep portable bundle on older glibc#2341brainrake wants to merge 3 commits into
brainrake wants to merge 3 commits into
Conversation
nixpkgs' bumped glibc (2.42) re-versions cfgetospeed, so a freshly built ncurses binds to the new GLIBC_2.42 symbol by default even though nothing about ncurses' own code changed. That breaks the portable CLI bundle on hosts with older glibc (e.g. Ubuntu 24.04's 2.39), since the bundle deliberately excludes glibc itself and relies on the host's. glibc still exports the old (functionally identical) GLIBC_2.17 version of cfgetospeed alongside the new one, so a .symver directive forces ncurses to bind to that instead - verified the patched build against the new glibc drops the GLIBC_2.42 requirement entirely (max symbol version falls back to GLIBC_2.38, matching every other bundled library).
The unconditional .symver directive broke the build on older glibc
(e.g. 2.40, currently on develop): older glibc only exports one
(unversioned-from-this-perspective) definition of cfgetospeed, so
requesting the GLIBC_2.17 version explicitly fails to link
("no symbol version section for versioned symbol"). Only glibc >= 2.42
actually carries both the old and new versioned symbols, so the override
must only apply then.
…compat The .symver approach broke the final link (ncurses' own -Wl,--version-script conflicts with a link-time versioned external symbol reference), and separately, the naive dlvsym-with-fallback first attempt still linked a bare reference to cfgetospeed for its fallback path, which just re-added the GLIBC_2.42 requirement it was meant to avoid. Resolving both dlvsym and its dlsym fallback dynamically (never referencing the bare cfgetospeed identifier in compiled code) sidesteps the linker entirely and degrades gracefully on any glibc, verified by building the patched ncurses against the bumped glibc: no cfgetospeed reference of any kind remains in the dynamic symbol table, and the max GLIBC symbol requirement drops back to 2.38, matching every other library in the bundle.
brainrake
force-pushed
the
fix/ncurses-old-cfgetospeed-symver
branch
from
August 2, 2026 00:23
94da426 to
4350e69
Compare
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.
Summary
Test plan