[lug] Need help understanding linking and loading shared libraries

Michael Hirsch mdhirsch at gmail.com
Mon Feb 4 17:41:33 MST 2008


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.

I was under the impression that since libboost.so satisfies all the
link requirements for libfoo, that it would satisfy the loader.  Is
there something I've have done that makes libfoo.so know the exact
version number of the libboost.so library?  Is there a way to turn off
this exactness requirement?

I expect I'm missing some seemingly trivial but crucial information,
but don't know what that is.

Thanks,

Michael



More information about the LUG mailing list