0

I have an executable but when I run it I get "No such file or directory"

$ chmod a+x bin 
$ file bin 
bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld64.so.1, not stripped
$ ./bin 
bash: ./bin: No such file or directory

Notice that this executable is in fact ELF 64-bit, as is the operating system.

1

This is because I forgot to include the -dynamic-linker options in the call to ld

-dynamic-linker /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2

Calling it as such,

ld -m elf_x86_64 -dynamic-linker /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -o bin

makes it work fine.

For more information from a similar problem with 32-bit/64-bit mismatch see this question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.