Bug: The RPATH setting in the executable isn’t honored during the
shared library load.
*) Prepare main.c and hello.c as below
*) Compile hello.c into shared library, as
qcc -shared -o libhello.so hello.c
*) Compile main.c with libhello loaded with
pwd as RPATH
pwd qcc -o main main.c -L. -lhello
*) Confirm that RPATH is embedded in the executable
objdump -p main | grep RPATH (should be
*) Test from current dir. This should work.
*) Test from another dir. This should work too, but fails.
The dynamic loader doesn’t search into RPATH paths set in the executable.
cd …; /main
*) (to make it work, set LD_LIBRARY_PATH to where the lib lives.)
Or am I missing something fatal (like ldconfig)?
(Then why does /usr/X11R6/bin binaries work? … Hmm,
LD_LIBRARY_PATH is set explicitly in Photon session… )
extern int hello(void);