public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* linking with local project libraries
@ 2007-12-20 23:20 petr.ellner
  2007-12-24 16:56 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: petr.ellner @ 2007-12-20 23:20 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: linking with local project libraries
  2007-12-20 23:20 linking with local project libraries petr.ellner
@ 2007-12-24 16:56 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2007-12-24 16:56 UTC (permalink / raw)
  To: petr.ellner; +Cc: binutils

Hi Petru,

> I'am dealing with following problem:
> I've got program P which depends on library A which depends on library B...

If library A needs library B then any program P which uses library A is also 
dependent upon library B.  Hence P either needs to know about library B and 
explicitly include information on how to locate it when P is linked or else 
library B needs to be placed in a standard location where it can be found by 
the linker.  Putting B in a non-standard location and then not telling the 
linker about it just does not work.

Cheers
   Nick





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-24 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-20 23:20 linking with local project libraries petr.ellner
2007-12-24 16:56 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).