LIBRARY_PATH priority - Reg

Lakshmi Narayana Velayudam dev.narayana.v@gmail.com
Tue Jan 9 09:13:53 GMT 2024


Dear GCC Team,
While trying to compile a project which depends on some shared libraries I
used LIBRARY_PATH variable to make sure they are searched in the right
directories during compile time. I noticed that gcc is searching for the
path in LIRBARY_PATH first but in the below way
Example:
export LIBRARY_PATH=/home/narayana/dependencies/
-> gcc is checking for /home/narayana/dependencies/../lib first then some
standard directories and then the actual path in LIBRARY_PATH
i.e.,/home/narayana/dependencies/ and then some more directories.

Due to this my project is getting compiled with libraries in standard
libraries. Is there a way to prevent this except the usage of -L flag and
also why does gcc assumes that the path I mentioned in LIBRARY_PATH has lib
folder... Should I create a lib folder then will it work on all
distributions?

I tried with gcc 4.8.5 Cent OS and gcc-9 on Ubuntu 22.2. Kindly let me know
if you need more details on this.

Regards,
Narayana


More information about the Gcc-help mailing list