Instead of using LD_LIBRARY_PATH, I want to specify the library search path through the -rpath option in the makefile. How can I do that? Assume the search path is the current directory.
Instead of using LD_LIBRARY_PATH, I want to specify the library search path through the
Share
You have three options:
use LDFLAGS to specify options for
ldcreate separate rules for compilation and linking, there you can parr
-rpath=/what/evertolddirectlyuse
-Wl,ldoptionforgccto propagateldoptionto linker. In your case:gcc ... -Wl,rpath=/what/ever ...Note that LD_LIBRARY_PATH serves for the dynamic linker/loader (
ldd) not for the linker that creates executables (ld).