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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21 June 2011 17:29, Jonathan Wakely wrote:
> On 21 June 2011 17:24, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
>> On 21 June 2011 17:15, Dun Peal wrote:
>>> Hello!
>>>
>>> I have the following line in a build script:
>>>
>>>    g++ [...] -Bdynamic /foo/bar.so
>>>
>>> This line results in a binary which when analyzed with `ldd(1)`, shows
>>> a dependency on `/foo/bar.so`.
>>>
>>> The problem is that the link-time and runtime platforms are not the
>>> same: at link-time, `bar.so` resides under `/foo`, while at runtime it
>>> lives under `/baz`.
>>>
>>> 1) Is there a way to link `bar.so` such that at compile (more
>>> precisely, link) time, it would be found at the former, while at
>>> runtime it would be found on the latter?
>>
>> Rename it to libbar.so and link to it with "-L/foo -lbar" instead of
>> giving an absolute path to the .so
>
> Actually I think I've misremembered how it works, you might need to
> create bar.so using -soname=bar.so so that ldd will only make it

Bah, that should say "ld" not "ldd"

I'm going to give up now before I type any more nonsense!



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux