I am getting the wrong .so at runtime even though I specified the right one at compile time:
samiam@samiam-linux-pc:~/projects/petit_ami$ make event
gcc -g3 -o event xterm.c event.c libc.so -lm
samiam@samiam-linux-pc:~/projects/petit_ami$ ./event
./event: relocation error: ./event: symbol ovr_write version
GLIBC_2.2.5 not defined in file libc.so.6 with link time reference
samiam@samiam-linux-pc:~/projects/petit_ami$ ldd event
linux-vdso.so.1 (0x00007ffda5ffa000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe641048000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe641642000)
samiam@samiam-linux-pc:~/projects/petit_ami$
I am using an alternative glibc .so, located in the current directory. I was able to prove that gcc is linking to the correct library, because if I remove the libc.so file, it complains about missing files. Also, if I remove the libc.so file from the gcc command line, I get the missing reference at runtime.
So the gcc works against my libc.so at compile time, but at runtime it goes to the standard location for libc.so instead of the local file. LD_DEBUG also shows this behavior. I also tried putting "." on the LIBRARY_PATH at first position, it had no effect.
The ideal answer would be to place a directory in the search order ahead of the others (as I tried to do with LIBRARY_PATH), since I define several local libs, not all with the same name.