[lug] Need help understanding linking and loading shared libraries

Michael Hirsch mdhirsch at gmail.com
Tue Feb 5 21:15:11 MST 2008


On Feb 5, 2008 10:37 AM, Zan Lynx <zlynx at acm.org> wrote:
>
> On Mon, 2008-02-04 at 17:41 -0700, Michael Hirsch wrote:
> > I thought I mostly understood this, but I'm definitely missing something.
> >
> > I have a library, lets call it libboost.so.1.33.1, though the real
> > name is longer.  There is also a copy of this file named libboost.so
> >
> > I build my own library, lets call it libfoo.so which relies on
> > libboost.  The option to g++ is -lboost.
> >
> > Finally, I have an executable, bar, that needs libfoo.so (again, with -lfoo).
> >
> > All this works.  But now, if I only have libboost.so and not
> > libboost.so.1.33.1 the loader will complain that it can't file
> > libboost.so.1.33.1.  In fact, "ldd bar" reports libboost.so.1.33.1,
> > rather than libboost.so like I expected.
>
>
> Check that your .so isn't actually a linker script.  For example, here
> is /usr/lib/libacl.so from my system:

Interesting.  That isn't my situation, but that is a good thing to
know to look out for.

> Also, I have Boost installed but no libboost.so anywhere, only the
> separate parts of Boost like libboost_thread.so, etc.  I understand that
> you may have shortened the name though.

Yeah, I just didn't want to type the full name.  It's too long.

Thanks,

Michael



More information about the LUG mailing list