On 11/16/17, Paul "LeoNerd" Evans <leon...@leonerd.org.uk> wrote: > I'm developing two different C libraries; lets just call them A and B. > A is fairly standalone, and B depends on A. [...] > But now suppose I have a possible change I want to make that needs > edits in both libraries. I don't want to build a new system package yet > and upset all the other users on this box. That's fine, I can just > install library A into my $HOME directory using > > $ make install PREFIX=$HOME > > In order to be able to test programs that use library A, I'm going to > need to set LD_LIBRARY_PATH now so they can find the library here in > preference to the system-installed one, so in my .profile I use
If A and B are libtool libraries, and B is linked with libtool against the installed version of A in $HOME, and your programs are linked against B also using libtool, then this should all "just work". Libtool should be automatically inserting the necessary linker flags to use the version of A installed in $HOME (e.g., by setting DT_RUNPATH to $HOME/lib on ELF platforms)... > export LD_LIBRARY_PATH=$HOME/lib ... and there should be no need to do this, in part because hacks like this cause the type of problems you are seeing. If that is not happening then maybe the libraries and/or programs are being linked incorrectly, or perhaps there's a bug in libtool. Example: build+install libfoo to non-system location: % libtool --tag=CC --mode=compile gcc -c foo.c % libtool --tag=CC --mode=link gcc -rpath /tmp/instlib -o libfoo.la foo.lo % libtool --mode=install cp libfoo.la /tmp/instlib build libbar, linked against libfoo: % libtool --tag=CC --mode=compile gcc -c bar.c % libtool --tag=CC --mode=link gcc -rpath /usr/local/lib -o libbar.la \ bar.lo /tmp/instlib/libfoo.la build application linked against uninstalled libbar: % libtool --tag=CC --mode=compile gcc -c app.c % libtool --tag=CC --mode=link gcc -o app app.lo libbar.la Inspection of results: % ldd .libs/app [...] libbar.so.0 => not found libfoo.so.0 => /tmp/instlib/libfoo.so.0 (0x00007fec8f7a9000) [we see that that the executable has the nonstandard location for libfoo, and libbar is not installed so it is not found by ldd, and finally...] % libtool --mode=execute ./app [works correctly] Cheers, Nick _______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool