linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Wuertele <dave-gnus@bfnet.com>
To: linux-c-programming@vger.kernel.org
Subject: Why does linking a.so with b.so require execs to be linked both -la and -lb?
Date: Mon, 11 Aug 2003 14:02:48 -0700	[thread overview]
Message-ID: <m3k79jj4av.fsf@bfnet.com> (raw)

#  I'm creating a shared library like this:
libDaveA.so: $(LIB_OBJECTS)
	$(CXX) -shared -ldl -rdynamic -o $@ $^ -lDaveB -lDaveC -lDaveD -lDaveE

#  And I have some executables that use the shared lib:
daveprog: daveprog.cpp
	$(CXX) -o $@ $^ -lDaveA

The executable doesn't use any of the functions from libDaveB.so,
libDaveC.so, libDaveD.so, or libDaveE.so.  It only uses functions from
libDaveA.so.  But when I compile with the above makefile, gcc
complains:

  /usr/tools/lib/gcc-lib/mipsel-linux/2.96/../../../../mipsel-linux/bin/ld: warning: libDaveB.so.0, needed by /usr/local/lib/libDaveA.so, not found (try using -rpath or -rpath-link)

Why is that?  Why should daveprog, which never uses any functionality
AT ALL from libDaveB.so, have to link to it?

Dave


             reply	other threads:[~2003-08-11 21:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-11 21:02 David Wuertele [this message]
2003-08-11 23:50 ` Why does linking a.so with b.so require execs to be linked both -la and -lb? Mike Castle
2003-08-12  0:10   ` David Wuertele
2003-08-12 13:49     ` Glynn Clements
2003-08-12 16:42       ` David Wuertele
2003-08-12 17:54         ` Glynn Clements
2003-08-12 19:12         ` Steven
2003-08-12  0:11   ` David Wuertele
2003-08-12 13:16 ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3k79jj4av.fsf@bfnet.com \
    --to=dave-gnus@bfnet.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).