LD_LIBRARY_PATH is not working in Makefile

If LD_LIBRARY_PATH is exported in Makefile and makefile is not working as you have expected, then you should try updating LIBRARY_PATH.

LIBRARY_PATH is used by gcc before compilation to search for directories containing libraries that need to be linked to your program.

If you wish to link static libraries, you should update LIBRARY_PATH and not LD_LIBRARY_PATH. I made a mistake and suffered for 2 hours.

LD_LIBRARY_PATH is used by your program to search for directories containing the libraries after it has been successfully compiled and linked.

See this question.

Leave a Reply

Scroll to Top