I have 2 files: ./a.out and libasm.so,
I can execute by using LD_LIBRARY_PATH without any problem:
$> export LD_LIBRARY_PATH=$PWD
$> ./a.out
42
But, if I reset the LD_LIBRARY_PATH and I use LD_PRELOAD, it doesn't work anymore:
$> export LD_LIBRARY_PATH=
$> LD_PRELOAD=./libasm.so ./a.out
./a.out: error while loading shared libraries: libasm.so: cannot open shared object file: No such file or directory
What should I do to fix that problem ? I must use LD_PRELOAD to make it works (and no LD_LIBRARY_PATH)
The compilation is as below:
$> gcc main.c -L. -lasm
And the library has been created with the following command:
$> nasm -f elf64 strlen.S -o strlen.o && gcc -shared strlen.o -o libasm.so
ldd command gives the following:
$> ldd ./a.out
linux-vdso.so.1 (0x00007ffdda9fe000)
/home/Nicolas/rendu/Assembleur/asm_minilibc/libasm.so (0x00007fb468f28000)
libasm.so => not found
libc.so.6 => /lib64/libc.so.6 (0x00007fb468b48000)
/lib64/ld-linux-x86-64.so.2 (0x0000555c0b2dd000)
$> ldd /home/Nicolas/rendu/Assembleur/asm_minilibc/libasm.so
linux-vdso.so.1 (0x00007fffe09bc000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb3390c2000)
/lib64/ld-linux-x86-64.so.2 (0x000055789183a000)
$> ls -l /home/Nicolas/rendu/Assembleur/asm_minilibc/libasm.so
-rwxrwxr-x. 1 Nicolas Nicolas 7728 18 mars 14:24 /home/Nicolas/rendu/Assembleur/asm_minilibc/libasm.so
Two lines refers to libasm.so, the first one is correctly found, but the second one is not found. Why is there 2 lines instead of one ?
Thank you very much,