according to docs, GCC looks paths in LD_LIBRARY_PATH for linking shared library BUT it seems in my case it is ignored!
echo $LD_LIBRARY_PATH -->:/home/mehrdad/usr/lib (so LD_LIBRARY_PATH is set currectly)
i have libfoo.so in "/home/mehrdad/usr/lib" BUT :
gcc main.c -lfoo returns error :
/usr/bin/ld: cannot find -lfoo
collect2: error: ld returned 1 exit status
so what is the problem??? is LD_LIBRARY_PATH deprecated???!
but i can successfully link with explicit command :
gcc main.c -L/home/mehrdad/usr/lib -lfoo
and also I can successfully execute the a.out by just:
./a.out
it seems LD_LIBRARY_PATH is respected by OS library loader BUT NOT GCC!
my environment : OS : CentOs 7 compiler : gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)