I'm trying to use the GNU readline library in a program written in FASM. This is my assembly code:
format elf64
public _start
extrn readline
section ".text" executable
_start:
push prompt
call readline
jmp _start
section ".data"
prompt db ">> ", 0
Then I compile and link it as follows:
$ fasm test.asm
$ ld -lreadline test.o -o test
However when I try to execute ./test
bash gives me the following error message:
bash: ./test: No such file or directory
The test
executable is present in the directory. What's wrong? Am I not linking the libreadline
library correctly?
This happened to me once when I was on a 64-bit system compiling code for 32-bit. You have to install some additional 32-bit development tools and libraries (like an appropriate variant of libc) so that 32-bit binaries can be recognized as executable as well.