libsystemd not found an error

Hello,

Attempting to configure r4762 is now "libsystemd not found".
However, we have confirmed that libsystemd related packages are
installed as follows.

checking for libexpat... found in /usr
checking for expat.h... yes
checking whether XML_StopParser is declared... yes
checking for libhiredis... checking for SYSTEMD... no
checking for SYSTEMD_DAEMON... no
configure: error: systemd enabled but libsystemd not found

$ dpkg -l | grep libsystemd
ii libsystemd-dev:armhf 232-25+deb9u3
armhf systemd utility library - development files
ii libsystemd0:armhf 232-25+deb9u3
armhf systemd utility library

environment:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

$ uname -sr
Linux 4.14.18-sunxi

At least, v1.7.3 confirms that configure will succeed.
It seems that the periphery of pkg - config has been modified with
r4757 etc, but is there anything related to this area?
# I'm sorry. I had no ability to read the configure file.

config.log
https://pastebin.com/xd6QTbJ9

Best regards.

Hi Yoshi Horigome,

Hello,

Attempting to configure r4762 is now "libsystemd not found".
However, we have confirmed that libsystemd related packages are
installed as follows.

It needs ht libsystemd-dev package with the header files.

It may also be the case that the difference is that configure was
generated but aclocal was not used, pkg-config autoconf macros did not
get instantiated and this makes the systemd detection fail. So, not
just run 'autoconf' but also aclocal (or run autoreconf that combines them).

I saw that the libhiredis printout is a problem, and I fixed that
printout in r4764.

In r4657 there is a change in configure.ac in the pkg-config macros for
making python module config use it. This change could be the culprit,
but I don't understand how detecting pkg-config could be a problem for
systemd detection later that also uses pkg-config.

Best regards, Wouter

Hello,

Wouter-san,

I delayed to reply.

When pkg-config is specified as below, configure now passes.

$ sudo ./configure --with-libevent --with-ssl --disable-static --sysconfdir=/etc/unbound --with-conf-file=/etc/unbound/unbound.conf --with-pidfile=/var/run/unbound.pid --enable-pie --enable-systemd --disable-rpath --enable-subnet PKG_CONFIG=“/usr/bin/pkg-config”

However, when you run make, it will be build failed on the way as follows.

event -lcrypto -lsystemd -pthread
/usr/bin/ld: error: undefined symbol: sd_is_socket_sockaddr

referenced by listen_dnsport.c:148 (services/listen_dnsport.c:148)
.libs/listen_dnsport.o:(systemd_get_activated)
collect2: error: ld returned 1 exit status
Makefile:322: recipe for target ‘unbound’ failed
make: *** [unbound] Error 1

I am also worried about warnings appearing on the way as follows.

services/listen_dnsport.c: In function ‘systemd_get_activated’:
services/listen_dnsport.c:148:8: warning: implicit declaration of function ‘sd_is_socket_sockaddr’ [-Wimplicit-function-declaration]
if(sd_is_socket_sockaddr(
^~~~~~~~~~~~~~~~~~~~~

I tried it with commit of trunk @ 4820.

In this case, is there anything else you need to deal with?

Best regards.

Hi Yoshihito Horigome,

Hello,

Wouter-san,

I delayed to reply.

When pkg-config is specified as below, configure now passes.

It is nice that configure works.

The sd_is_socket_sockaddr function was added in Dec 14, 2016
https://github.com/systemd/systemd/commit/f6f372d2f46ac9be7cbb1ecd8f82f1b3ab669924#diff-cc45620f66c43ebd347d5d003647520e
It could be that the systemd that you use does not have that commit yet
and thus does not have the API? The v233 tag makes me think that
systemd 2.3.3 has the feature introduced.

Are you interested in using the socket activation code? Because I got
replies for the NSD daemon that systemd socket activation is not useful
for DNS servers and the code has bugs (and I want to remove bugs). It
is possible to not use the sockaddr code, but I wanted to add more
checking to remove potential bugs. If you use systemd, perhaps you can
tell me what is actually useful for systemd users; and then I'll use
that version of the systemd_get_activated routine.

The code repository version should howevery have much better readiness
signalling for systemd, I took it out of a signal handler and rewrote it
elsewhere to only get enabled when the use-systemd config option in
unbound.conf is set to yes.

If you need code without the sockaddr check, here is the patch:

Index: services/listen_dnsport.c

Hello Wouter-san,

Thank you for your reply and information.
I am running this build in the following environment.

$ uname -mrs
Linux 4.14.18-sunxi armv7l
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.5 (stretch)
Release: 9.5
Codename: stretch

The version of systemd in this environment was 232.

$ dpkg -l | grep systemd
ii libpam-systemd:armhf 232-25+deb9u4
armhf system and service manager - PAM module
ii libsystemd-dev:armhf 232-25+deb9u4
armhf systemd utility library - development files
ii libsystemd0:armhf 232-25+deb9u4
armhf systemd utility library
ii python-systemd 233-1
armhf Python 2 bindings for systemd
ii python3-systemd 233-1
armhf Python 3 bindings for systemd
ii systemd 232-25+deb9u4
armhf system and service manager
ii systemd-sysv 232-25+deb9u4
armhf system and service manager - SysV links

I checked the debian repository, but this seems to be the latest at the moment.
In the debian environment, do you think that build can not be built
with systemd enabled?

Best regards.

Hi Yoshi Horigome,

Hello Wouter-san,

Thank you for your reply and information.
I am running this build in the following environment.

I see this version of Debian is not at that version for systemd. Okay,
I have applied the patch I proposed previously to the unbound source, so
that unbound can build for that system. Thank you for checking the
version numbers.

Best regards, Wouter

Hello Wouter-san,

I confirmed that it can be built with svn @r4824.
Thank you for your response and advice.

Best regards.