This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: How do I link to a shared lib without having that lib's dependencies (the way MS link does)
David Wuertele <dave-gnus@bfnet.com> writes:
> Me> # Compile and link prog.c to libA.so
> Me> gcc -o prog prog.c -L. -lA
> Me> /usr/bin/ld: warning: libB.so, needed by ./libA.so, not found
> Me> (try using -rpath or -rpath-link)
>
> Richard> Did you even try the suggestion? Adding -rpath-link=. would
> Richard> indeed have solved your problem.
>
> The first thing I did was read the manual, and discover that
> -rpath-link= doesn't do what I want.
>
> Then I tried it, and confirmed it doesn't do what I want.
>
> I want to be able to link to libA.so WITHOUT libB.so being on the disk
> or on anyone's disk.
>
> The libB.so will be available at runtime ONLY. Not at link time.
Why can't you make libB.so (or a stub version of it) available at link
time?
--
- Geoffrey Keating <geoffk@geoffk.org>