This webpage tells me that we can use $ORIGIN
to bake the dir of executable as searching dir into executable. This runpath
command can be written as:
-Wl,--enable-new-dtags,-rpath,"\$ORIGIN"
But the shared library I am trying to load is not exactly in the same dir as the executable. It is in a subdir, say LIB
, of where the executable is. That webpage does not tell me how to do that. I tried many ways to concatenate LIB but of no avail, like "\$ORIGIN/LIB", "\$ORIGIN"/LIB, \$ORIGIN/LIB or "\$ORIGIN/LIB/". I didn't find any clue from google search either. Can you please tell me the right syntax of $ORIGIN to specify a dir relative to it in runpath flag? Thank you.
PS: I'm working on ubuntu 16.04 with GNU make 4.1 and GNU ld 2.26.1.