tsm
tsm

Reputation: 63

No such file or directory on binary which exists

I'm trying to run a binary from the ghidra suite. (Actually, I'm running ghidra itself, but it's failing to run the binary internally).

[nix-shell:~]$ ./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile 
bash: ./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile: No such file or directory

I can't for the life of me figure out what the problem is: I read that missing libs can cause this, and ldd reported that libstdc++.so.6 was missing. After much mucking about getting libstdc++.so.6 to be picked up (nix seems to make life difficult there), I'm greeted with the same error:

[nix-shell:~]$ ./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile 
bash: ./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile: No such file or directory

[nix-shell:~]$ ldd ./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile 
        linux-vdso.so.1 (0x00007fffd9293000)
        libstdc++.so.6 => /nix/store/f09zmq3sqiy0dnx8g4f1arngkjd4kih7-gcc-7.4.0-lib/lib64/libstdc++.so.6 (0x00007f20ca795000)
        libm.so.6 => /nix/store/h0p0h3rh1q4i2yavzm3yqi716s9yaj2f-glibc-2.27/lib/libm.so.6 (0x00007f20ca5ff000)
        libgcc_s.so.1 => /nix/store/f09zmq3sqiy0dnx8g4f1arngkjd4kih7-gcc-7.4.0-lib/lib64/libgcc_s.so.1 (0x00007f20ca5e6000)
        libc.so.6 => /nix/store/h0p0h3rh1q4i2yavzm3yqi716s9yaj2f-glibc-2.27/lib/libc.so.6 (0x00007f20ca430000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/h0p0h3rh1q4i2yavzm3yqi716s9yaj2f-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f20ca921000)

Does anyone have any more ideas? A little more info:

[nix-shell:~]$ file ./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile 
./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=bd3c148954c7800224c513a9d91ce61e50cb1a03, not stripped

Upvotes: 3

Views: 3210

Answers (1)

Amine Chikhaoui
Amine Chikhaoui

Reputation: 345

In the file command output interpreter /lib64/ld-linux-x86-64.so.2 seems to be wrong. maybe try this to make the executable work:

patchelf --set-interpreter $(patchelf --print-interpreter `which cp`) \
  ./ghidra/Ghidra/Features/Decompiler/os/linux64/decompile

Upvotes: 3

Related Questions