This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

Re: Linking against shared objects that reside at different paths on link-time versus runtime?


On Tue, Jun 21, 2011 at 12:06 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> -lbar tells the linker to look for
> libbar.so, and if it finds libbar.so with a soname it creates a
> dependency on the soname, if it finds libbar.so without a soname it
> creates a dependency on the file's name, including the full path when
> you link to /foo/bar.so. ?So -lxxx can only match a file called
> libxxx.so (or libxxx.a), to do what you suggest it would have to open
> every single file and check if it has the requested soname, that won't
> work.

Just to make sure I understand: you are saying that with `-L/foo
-lbar`, ld is going to look for `libbar.so` inside `/foo`, check if it
has an soname, and if it does: link to it.

But how is it going to find the library with the same soname at
runtime?  Will it have to open every `lib*` file in the load path
(i.e. the system default + LD_LIBRARY_PATH) and look at its soname?

Also, if `libbar.so` doesn't have an soname, what exactly did you mean
when you wrote that the binary product will include the "full path"?

Thanks, D.


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