This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
linking with local project libraries
- From: petr dot ellner at seznam dot cz
- To: binutils at sourceware dot org
- Date: Fri, 21 Dec 2007 00:20:47 +0100 (CET)
- Subject: linking with local project libraries
Hi,
I'am dealing with following problem:
I've got program P which depends on library A which depends on library B (A uses function from B, program uses function *only* from A). Each of these three items has own directory and own makefile. P is built only with -LdirA -lA and A is built only with -LdirB -lB. when I'am building P I get /bin/ld: warning: libB.so, , needed by Adir/libA.so ... not found (try using -rpath or -rpath-link). I know that problem is that when linking P, static linker finds dependency in A and then it cannot solve it because dirB is not in standard runtime library search path. My question is, if there is some standard solution for it, when writing build system ? I'am not sure if -rpath-link can provide such solution. Let's say I am writing makefile for P. I just know that I need A and I do not want to care about what A depends on and add -rpath-link for each dependency (consider that A transitively depends on whole tree of other 'project' libraries) I just want to care about stuff that is relevant from P's perspective.
One solution which crossed my mind is whether there is some way how to force ld to solve only direct dependencies of particular object so behavior would be similar to behavior of linking on Windows or AIX. This would mean that linker would just solve dependencies of P and wouldn't go deeper. With combination with --no-undefined it could maybe work ? :)
Thanks,
Petru