Search path for Berkeley DB linkage

Russ Allbery rra at
Sat Oct 1 17:57:03 UTC 2011

Julien ÉLIE <julien at> writes:

> I am a bit puzzled by how DB_LDFLAGS and DB_LIBS are used
> in our source code.  They seem to be properly set in STORAGE_LIBS;
> and used at link time for our libraries.

> The issue I am facing is that when I want to run innd, I obtain:

> ./innd: error while loading shared libraries: cannot open shared object file: No such file or directory

> Yet, I have in

> DB_CPPFLAGS     = -I/home/iulius/autobuild/bin/db-5.2.36/include
> DB_LDFLAGS      = -L/home/iulius/autobuild/bin/db-5.2.36/lib
> DB_LIBS         = -ldb -lz

> DBM_CPPFLAGS    = -I/home/iulius/autobuild/bin/db-5.2.36/include
> DBM_LIBS        = -L/home/iulius/autobuild/bin/db-5.2.36/lib -ldb

INN adds the flags to find the library at link time, but doesn't add the
flags to encode an RPATH in the binary for runtime.  This is somewhat
intentional; there are various scenarios in which you want to build
software against libraries in temporary paths, but don't want to encode
those paths into the resulting binary because, later on, the libraries
will be moved to a standard location in the search path.

If you set LD_RUN_PATH in the environment while building INN, the linker
will encode an RPATH in the binaries.

There are more details about the whole situation at:

Russ Allbery (rra at             <>

    Please send questions to the list rather than mailing me directly.
     <> explains why.

More information about the inn-workers mailing list