Woah I love that! +1, I don't see why we can't do that… Wout.
On Wed, Apr 20, 2016 at 1:52 PM Silvio Frischknecht <[email protected]> wrote: > Hello, > > I recently found out that if you set the SONAME of a library to an > absolute path. > > gcc --shared -Wl,-soname="$(pwd)/libxyz.so" -o libxyz.so libxyz.c > > and then later link to it > > gcc main.c -L. -lxyz > > the dynamic linker will only look for the library in the exact path > specified when compiling the library. > > Advantages over RPATH: > + probably faster since rpaths in nixos tend to be quite long and every > library has to be looked for in every folder (linear vs quadratic > complexity) > + only has to be setup once per library - all referrers will > automatically work correctly > > In this case the path can't be overwritten by LD_LIBRARY_PATH. I guess > that could be an advantage or a disadvantage depending on how you look > at it. > > Cheers > > Silvio > _______________________________________________ > nix-dev mailing list > [email protected] > http://lists.science.uu.nl/mailman/listinfo/nix-dev > -- Wout. (typed on mobile, excuse terseness)
_______________________________________________ nix-dev mailing list [email protected] http://lists.science.uu.nl/mailman/listinfo/nix-dev
