[kea-dev] kea support for log4cplus library

Stephen Morris stephen at isc.org
Thu May 4 14:17:43 UTC 2017

On 26/04/17 15:03, tianxiang li wrote:
> Hi,
> I've been trying to make compile Kea-1.2.0-Beta in Ubuntu 14.04, and
> encountered a problem with the log4cplus library, the error code is as
> follow:
> .../kea-1.2.0-beta/src/lib/log/compiler/.libs/lt-kea-msg-compiler: error
> with file loading shared libraries: liblog4cplus-2.0.so.3; cannot open
> shared object file: No such file or directory
> I've installed both the newer version log4cplus-2.0.0 and the older
> 1.1.2 version, and met the same problem. 
> Thank you!
> Tianxiang

The message you are getting is saying that while trying to run the
message compiler(*), the system was unable to find the log4cplus
dynamically loaded library.

The compiler is linked against the logging library (libkea-log.so) and
it is this component that requires log4cplus.  As the message compiler
has been built, then so has libkea-log, something that will have
required that the log4cplus library was present.  So the library appears
to be there when libkea-log is built, but is not being found when the
message compiler is run.

To try to find where the system is expecting to find the log4cplus
library, issue the command

readelf -d <kea-top>/src/lib/log/.libs/libkea-log.so

... replacing "<kea-top>" with the directory in which you built Kea. You
should see output similar to:

ceres:~:2008% readelf -d /users/stephen/kea/src/lib/log/.libs/libkea-log.so

Dynamic section at offset 0x2ba58 contains 33 entries:
  Tag  Type     Name/Value
<..> (NEEDED)  Shared library: [libkea-exceptions.so.0]
<..> (NEEDED)  Shared library: [libpthread.so.0]
<..> (NEEDED)  Shared library:
<..> (NEEDED)  Shared library: [libkea-util.so.2]
<..> (NEEDED)  Shared library:
<..> (NEEDED)  Shared library: [libstdc++.so.6]
<..> (NEEDED)  Shared library: [libc.so.6]
<..> (NEEDED)  Shared library: [libgcc_s.so.1]
<..> (SONAME)  Library soname: [libkea-log.so.3]
<..> (RPATH)   Library rpath:
<..> (INIT)    0x10198

(To make the output clearer, I've removed the values in the first column
(the Tag column) and compressed some spaces.  Also, owing to the
restrictions of my email client, some of output has been split across
multiple lines.)

The bit you are looking for is the RPATH line, which gives the list of
directories searched for the libraries.  One of these should correspond
to the directory where log4cplus is installed. The example above shows
that libkea-log.so was linked against liblog4cplus-1.2.so.5 and it is
reasonably intuitive to see that the system is expecting to find that
library in the directory /opt/log4cplus-1.2.0/lib


(*) The message compiler is created early on in the build process and is
responsible for converting the message (.mes) files - which list the
code, message and explanation for each message that Kea could log - into
C++ source code that can be built into Kea.

More information about the kea-dev mailing list