Document pkg-config is required to compile tor with --enable-systemd on debian
I was missing this detail to compile tor on debian with --enable-systemd
.
This information is missing in the FAQs too: https://support.torproject.org/ https://www.torproject.org/docs/faq#comp-install
Improving the error message to mention pkg-config would be nice:
./configure --enable-lzma=yes --enable-zstd=yes --disable-asciidoc --disable-unittests --enable-systemd=yes --prefix=/usr {{{
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define EXTENSIONS... yes checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for pkg-config... no checking for SYSTEMD... no configure: Okay, checking for systemd a different way... checking for SYSTEMD... no configure: error: Explicitly requested systemd support, but systemd not found }}}
$ dpkg -l|grep systemd
ii dbus-user-session 1.10.26-0+deb9u1 all simple interprocess messaging system (systemd --user integration)
ii gnome-logs 3.22.1-2 i386 viewer for the systemd journal.
ii libpam-systemd:i386 232-25+deb9u6 i386 system and service manager - PAM module
ii libsystemd-dev:i386 232-25+deb9u6 i386 systemd utility library - development files
ii libsystemd0:i386 232-25+deb9u6 i386 systemd utility library
ii systemd 232-25+deb9u6 i386 system and service manager
ii systemd-sysv 232-25+deb9u6 i386 system and service manager - SysV links
This was documented in 2015 (legacy/trac#16164 (moved)):
/configure --build=s390x-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libexecdir=${prefix}/lib/tor --disable-maintainer-mode --disable-dependency-tracking --enable-systemd --prefix=/usr --mandir=${prefix}/share/man --infodir=${prefix}/share/info --localstatedir=/var --sysconfdir=/etc --disable-silent-rules --enable-gcc-warnings-advisory configure: WARNING: unrecognized options: --disable-maintainer-mode ... configure: error: Package requirements (systemd >= 209) were not met: No package 'systemd' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables SYSTEMD209_CFLAGS and SYSTEMD209_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
Trying current build options at home also fails when pkg-config isn't present:
./configure --build=i686-linux-gnu --prefix=/usr --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=/usr/lib/i386-linux-gnu --libexecdir=/usr/lib/i386-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --enable-systemd --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --localstatedir=/var --sysconfdir=/etc --disable-silent-rules --enable-gcc-warnings-advisory configure: WARNING: unrecognized options: --disable-maintainer-mode ... checking for pkg-config... no checking for SYSTEMD... no configure: Okay, checking for systemd a different way... checking for SYSTEMD... no configure: error: Explicitly requested systemd support, but systemd not found
This ought to be common knowledge and it should be documented therefor.
Background: I was overwriting /usr/bin/tor with a compiled version without systemd support and experienced an undocumented in /usr/share/doc/tor systemd feature that lead to a restart loop (legacy/trac#28410 (moved)).