Skip to content

Fix linking in nix build#47

Open
christian-blades-cb wants to merge 1 commit intosnowmead:mainfrom
christian-blades-cb:fixup-nix-linking
Open

Fix linking in nix build#47
christian-blades-cb wants to merge 1 commit intosnowmead:mainfrom
christian-blades-cb:fixup-nix-linking

Conversation

@christian-blades-cb
Copy link
Copy Markdown

Adds autoPatchElfHook, which corrects binary linking against build inputs.

Before:

$ nix build .#
$ ./result/rust-docs-mcp
/nix/store/8x2jh96knxsclgzz7b81q07i3iiaxikj-rust-docs-mcp-0.1.1/bin/rust-docs-mcp: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory)
$ ldd /nix/store/8x2jh96knxsclgzz7b81q07i3iiaxikj-rust-docs-mcp-0.1.1/bin/rust-docs-mcp                                                                                                                              
        linux-vdso.so.1 (0x00007f61b951a000)                                                                                                                                                                         
        libssl.so.3 => not found                                                                                                                                                                                     
        libcrypto.so.3 => not found                                                                                                                                                                                  
        libgcc_s.so.1 => /nix/store/m2047a1xwgblgkrnbxz0yilkaqfrbf2b-xgcc-14-20241116-libgcc/lib/libgcc_s.so.1 (0x00007f61b94e6000)                                                                                  
        libm.so.6 => /nix/store/rmy663w9p7xb202rcln4jjzmvivznmz8-glibc-2.40-66/lib/libm.so.6 (0x00007f61b7717000)                                                                                                    
        libc.so.6 => /nix/store/rmy663w9p7xb202rcln4jjzmvivznmz8-glibc-2.40-66/lib/libc.so.6 (0x00007f61b7400000)                                                                                                    
        /nix/store/cg9s562sa33k78m63njfn1rw47dp9z0i-glibc-2.40-66/lib/ld-linux-x86-64.so.2 => /nix/store/rmy663w9p7xb202rcln4jjzmvivznmz8-glibc-2.40-66/lib64/ld-linux-x86-64.so.2 (0x00007f61b951c000)

It appears that the build isn't linking against the build inputs. In nixos the libraries aren't in a standard location, and the resulting binary is unusable.

@schlich
Copy link
Copy Markdown

schlich commented Mar 30, 2026

can confirm this fixed things for me too

@christian-blades-cb
Copy link
Copy Markdown
Author

@snowmead can you take a look please?

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