Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary with hard-coded /lib64/ld-linux-x86-64.so.2 path #319

Open
mimame opened this issue Feb 4, 2023 · 3 comments
Open

Binary with hard-coded /lib64/ld-linux-x86-64.so.2 path #319

mimame opened this issue Feb 4, 2023 · 3 comments

Comments

@mimame
Copy link

mimame commented Feb 4, 2023

This happens with NixOS

When I run
curl https://nim-lang.org/choosenim/init.sh -sSf | sh

choosenim-init: Downloading choosenim-0.8.4_linux_amd64
main: line 77: /tmp/cn/choosenim-0.8.4_linux_amd64: No such file or directory

After some investigations, I realized the next:
ldd choosenim-0.8.4_linux_amd64

linux-vdso.so.1 (0x00007fff77de9000)
        libm.so.6 => /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/libm.so.6 (0x00007f81cee39000)
        librt.so.1 => /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/librt.so.1 (0x00007f81cee34000)
        libdl.so.2 => /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/libdl.so.2 (0x00007f81cee2f000)
        libc.so.6 => /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/libc.so.6 (0x00007f81cec00000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib64/ld-linux-x86-64.so.2 (0x00007f81cef1b000)

When I compile choosenim by myself, I get the good path:
ldd choosenim

linux-vdso.so.1 (0x00007ffd309c4000)
        libm.so.6 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/libm.so.6 (0x00007fb8ebd48000)
        librt.so.1 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/librt.so.1 (0x00007fb8ebd43000)
        libdl.so.2 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/libdl.so.2 (0x00007fb8ebd3e000)
        libc.so.6 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/libc.so.6 (0x00007fb8eba00000)
        /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/ld-linux-x86-64.so.2 => /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib64/ld-linux-x86-64.so.2 (0x00007fb8ebe2a000)

I don't know if this can be solved, but to I hope to be useful in any case

Thanks so much in advance

@xTrayambak
Copy link

xTrayambak commented Aug 13, 2023

Can confirm. I've tried this out too and the same error occurs.

@daylinmorgan
Copy link

You can try to get around this using nix-ld

I include the following in my nixos configuration:

...
  programs.nix-ld.enable = true;
  programs.nix-ld.libraries = with pkgs; [
    stdenv.cc.cc
    curl # for choosenim
  ];
...

@daylinmorgan
Copy link

Though while nix-ld helps to run binaries that were linked with /lib64/ld-linux-x86-64. I think it will create problems down the road running anything that relies on dynlib. I just found out I get runtime errors after compiling with -d:ssl. I don't have this issue with the nim2 package in nixpkgs though.

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

No branches or pull requests

3 participants