Repository navigation
claude-code: use DT_RPATH for alsa-lib instead of LD_LIBRARY_PATH - #569098
markus1189 wants to merge 1 commit into
Conversation
9c2f8f2 to
c21766c
Compare
✅
|
The nixpkgs claude-code wrapper and the local claude-desktop wrapper both prefixed LD_LIBRARY_PATH, which every Bash tool call inherited: devshells on an older glibc could no longer start ffmpeg or chromium (`GLIBC_2.43` not found via alsa-lib's libasound). claude-code: drop the prefix and put alsa-lib on .claude-wrapped's DT_RPATH instead, mirroring NixOS/nixpkgs#569098. The embedded audio-capture.node has no RUNPATH, and glibc only falls back to the executable's DT_RPATH. claude-desktop: drop the prefix outright. ANGLE is linked into the main executable, whose RUNPATH already carries libglvnd; LD_DEBUG confirms libEGL.so.1 and the mesa driver load without it.
c21766c to
c268f05
Compare
✅
|
c268f05 to
e5f384a
Compare
✅
|
e5f384a to
dd22a02
Compare
✅
|
dd22a02 to
6eb859a
Compare
✅
|
|
I tested some variants of the derivation locally with the help of Claude and it seems that most of the things can be done through I also unified |
6eb859a to
6d8bc70
Compare
|
Thanks, that's simpler. I switched the PR to your version and added you as co-author. I checked that autoPatchelf really calls the patched patchelf from Voice mode works on x86_64-linux with the new build. |
✅
|
6d8bc70 to
cc3fa55
Compare
✅
|
cc3fa55 to
5f4e762
Compare
✅
|
LD_LIBRARY_PATH leaked into child processes and broke system binaries loading libasound when glibc versions differ. Assisted-by: Claude Code (Claude Opus 5.5) Co-authored-by: Mirko Lenz <[email protected]>
5f4e762 to
b27c125
Compare
✅
|
…69098) The wrapper prefixes LD_LIBRARY_PATH with alsa-lib, which every child process inherits. Linking it through the binary's rpath keeps it out of the environment.
|
Closing: this no longer works with current releases. Adding any DT_RPATH to the binary (this version, the earlier |
The claude-code 2.1.301-2.1.303 bumps (NixOS/nixpkgs#574646, #575166, #575849) are all in the locked nixpkgs. NixOS/nixpkgs#569098 was closed unmerged: any DT_RPATH on current claude-code builds makes ld.so segfault, so the alsa-lib LD_LIBRARY_PATH wrapper is back to upstream's. synapdeck's determinate now follows ours instead of pinning 3.22.5.
The claude-code wrapper prefixes
LD_LIBRARY_PATHwith alsa-lib (added in dbacac5 for voice mode). Every child process inherits it, e.g. commands run by the Bash tool. If claude-code comes from a newer nixpkgs than the rest of the system, system binaries that load libasound fail:This PR drops the
LD_LIBRARY_PATHprefix and lets autoPatchelf addalsa-libto the binary'sDT_RPATH(runtimeDependencieswithpatchelfFlags = [ "--force-rpath" ]).Adding the rpath relocates
.gnu.version_d, but patchelf does not updateDT_VERDEF(NixOS/patchelf#664).ld.sothen walks the clobbered old copy and segfaults in_dl_check_map_versionson aarch64-linux; x86_64-linux has the same stale pointer and only works because the old bytes happen to survive. The package therefore puts patchelf with the unmerged fix (NixOS/patchelf#665), backported to 0.15.2, intonativeBuildInputs, where autoPatchelf picks it up; the override can go once nixpkgs' patchelf includes it.The install check asserts
DT_RPATH: aDT_RUNPATHwould not reach the dlopen'd module and break voice mode silently.The fix stays local rather than going into
patchelf(stdenv mass rebuild) orpatchelfUnstable(its other users would change behaviour without a review of their own). As claude-code is unfree, Hydra does not build the patched patchelf; it is built locally, which is cheap.Voice mode (hold-to-talk) tested on my machine with this build: recording worked.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.This PR (investigation, change and description) was prepared with Claude Code and reviewed by me.