Boost logo

Boost Users :

Subject: Re: [Boost-users] [version 1.38.0] Problems with dynamic linking to boost libraries
From: Rudolf Leitgeb (r.leitgeb_at_[hidden])
Date: 2009-03-12 12:14:09


> I've added /usr/local/lib to /etc/ld.so.conf and now it works.
> What I don't understand is why the linker didn't complain (the
> problem was when executing),

That's actually the way dynamic linking works under UNIX: You tell the
linker
which libraries to link with, but aren't tied to this library location
when
you deploy the program (e.g. on a different computer). Hence you use the
-L directive to tell gcc/ld where to look for libraries (shared or
static),
and have to edit ld.so.conf to tell the dynamic linker (the program
which
looks through all referenced dynamic libraries for symbols when you
start
your executable) where to look for libraries when running executables.

Note, that you don't have to edit ld.so.conf: you could instead set
the variable LD_LIBRARY_PATH to the library location (works like
the PATH environment variable, so you can provide multiple paths
separated by colons). This way you can accomplish your task without
super user privileges. Note, that the variable is called
DYLD_LIBRARY_PATH
on Mac OSX systems.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net