This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How do I link to a shared lib without having that lib's dependencies (the way MS link does)


Some of you might remember this thread:

  http://thread.gmane.org/gmane.comp.gnu.binutils/1048

I have re-tested with GNU ld version 2.15.92.0.2 20040927 and the
problem still remains.

To rehash the original problem of August 2003, I have two libraries:
libB.so, and libA.so.  libA.so depends on libB.so.  I want to compile
a program that ONLY uses libA.so's interface.  I do NOT have libB.so
on my disk.  But ld gives an error:

  gcc -o prog prog.c -L./A -lA
  /usr/bin/ld: warning: libB.so, needed by ./A/libA.so, not found (try using -rpath or -rpath-link)
  ./A/libA.so: undefined reference to `libB_func'
  collect2: ld returned 1 exit status

Some people tried to tell me that -rpath-link would solve my problem.
They were wrong.   -rpath-link would only help if I have libB.so on my
filesystem.  I do not.

Nick Clifton and Ian Lance Taylor posted different patches to deal
with the problem, mainly by downgrading the "error" to a "warning".
Either of those patches would probably solve my problem, but before I
go and track those down and try to apply them I was wondering if
anyone could tell me whether this problem has already been solved in
the binutils head revision.

I did a CVS checkout and looked in the ChangeLog but I did not
recognize anything that resembled their patches.  Can anyone point me
at the solution?

Thanks,
Dave


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]