Use executable's RPATH in looking up library searching path.

Laurent Bercot ska-dietlibc at skarnet.org
Thu Sep 22 15:53:23 UTC 2011


> gcc -Wall -shared -z def -o libb.so -fPIC -D_GNU_SOURCE libb.c
> gcc -Wall -shared -z def -o liba.so -fPIC -D_GNU_SOURCE liba.c -L. -lb
> gcc -Wall -o main_app -D_GNU_SOURCE -Wl,-rpath,/home/filippo/rpath-test main_app.c -L. -la
> 
> root at arcidiaf:/home/filippo/rpath-test# ./main_app 
> ./main_app: can't load library 'libb.so'
> ------------------------------------

 I would absolutely expect that behaviour.
 If you also link your executable with -lb, you should not have this problem.

 Maybe it's the static linking advocate in me speaking, but I have always
felt that handling dependencies when linking libraries instead of when linking
executables was a recipe for trouble.

-- 
 Laurent


More information about the uClibc mailing list