Opened 4 years ago

Closed 4 years ago

#14072 closed defect (fixed)

-lsystemd-daemon does not exist

Reported by: h.venev Owned by:
Priority: High Milestone: Tor: 0.2.6.x-final
Component: Core Tor/Tor Version: Tor: 0.2.6.2-alpha
Severity: Keywords:
Cc: candrews@… Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

--- configure.ac        2015-01-01 22:44:27.241420834 +0200
+++ -   2015-01-01 22:49:21.475246979 +0200
@@ -123,14 +123,15 @@
     have_systemd=no;
 else
     PKG_CHECK_MODULES(SYSTEMD,
-        [libsystemd-daemon],
+        [libsystemd],
         have_systemd=yes,
         have_systemd=no)
 fi
 
 if test x$have_systemd = xyes; then
     AC_DEFINE(HAVE_SYSTEMD,1,[Have systemd])
-    TOR_SYSTEMD_LIBS="-lsystemd-daemon"
+    CFLAGS="${CFLAGS} ${SYSTEMD_CFLAGS}"
+    TOR_SYSTEMD_LIBS="${SYSTEMD_LIBS}"
 fi
 AC_SUBST(TOR_SYSTEMD_LIBS)
 

Child Tickets

Change History (11)

comment:1 Changed 4 years ago by nickm

Milestone: Tor: 0.2.6.x-final
Status: newneeds_review

Is this version-dependent? Will this break with older versions of system? (If so, do any relevant distributions still use these versions of systemd?)

comment:2 Changed 4 years ago by blueness

Hi Nick. This was reported downstream by Venev. See:

https://bugs.gentoo.org/show_bug.cgi?id=534246

We had the same issue with stunnel-5.06 and we got a switch --with-systemd and the correct intelligence. I can hack up something similar for tor.

For the discussion with stunnel, see

https://www.stunnel.org/pipermail/stunnel-users/2014-October/004809.html

comment:3 Changed 4 years ago by h.venev

The change happened between systemd versions 208 and 209. Debian 7.0 uses version 44. Fedora 20 uses version 208. For compatibility with those distros the PKG_CHECK_MODULES statement should remain the same. This will work on newer versions for the time being (the pkg-config modules are provided). However -libsystemd-daemon does not exist on Debian Testing, Fedora >= 21, Arch, Gentoo and many other distros.

Linking against the libraries provided by pkg-config and not hardcoding -l flags is the idea why pkg-config exists. Please don't disappoint the pkg-config developers.

comment:4 Changed 4 years ago by nickm

Okay, so if I apply the patch above, I don't break older systems? Sounds fine to me then. Thanks.

comment:5 Changed 4 years ago by nickm

oh wait, you say the PKG_CHECK_MODULES statement should remain the same.

comment:6 in reply to:  4 Changed 4 years ago by blueness

Replying to nickm:

Okay, so if I apply the patch above, I don't break older systems? Sounds fine to me then. Thanks.

On gentoo we have a sym link between libsystemd-daemon and libsystemd for backwards compat and we ship systemd-215 (stable) and 216..218 (unstable). So we are good.

comment:7 Changed 4 years ago by nickm

So, when I try to apply the second half of the above patch, I get:

make[1]: Entering directory `/home/nickm/src/tor'
gcc -std=gnu99 -DHAVE_CONFIG_H -I.  -DTOR_UNIT_TESTS -I./src/ext -Isrc/ext -I./src/ext/trunnel -I./src/trunnel -I./src/common -Isrc/common -I./src/ext/trunnel -I./src/trunnel -I./src/or -Isrc/or -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I./src/common     -fno-inline -fprofile-arcs -ftest-coverage -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -fwrapv --param ssp-buffer-size=1 -fPIE -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror -Winit-self -Wmissing-field-initializers -Wold-style-definition -Waddress -Wmissing-noreturn -Wstrict-overflow=1 -Wnormalized=id -Woverride-init -Wextra -Warray-bounds -Wlogical-op -MT src/or/src_or_libtor_testing_a-control.o -MD -MP -MF src/or/.deps/src_or_libtor_testing_a-control.Tpo -c -o src/or/src_or_libtor_testing_a-control.o `test -f 'src/or/control.c' || echo './'`src/or/control.c
In file included from /usr/include/unistd.h:25:0,
                 from src/or/or.h:33,
                 from src/or/control.c:13:
/usr/include/features.h:327:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^
cc1: all warnings being treated as errors

comment:8 Changed 4 years ago by blueness

You're missing -O2 in your CFLAGS. _FORTIFY_SOURCES=2 only kicks in at -O2 and above, at least the way we cook gcc in gentoo. You might want to try changing

CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"

to

CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -O2"

at line 682.

comment:9 Changed 4 years ago by nickm

Well, when I compile without this patch, the command line is like:

gcc -std=gnu99 -DHAVE_CONFIG_H -I.  -I./src/ext -Isrc/ext -I./src/ext/trunnel -I./src/trunnel -I./src/common -Isrc/common -I./src/ext/trunnel -I./src/trunnel -I./src/or -Isrc/or -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I./src/common     -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -fwrapv --param ssp-buffer-size=1 -fPIE -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror -Winit-self -Wmissing-field-initializers -Wold-style-definition -Waddress -Wmissing-noreturn -Wstrict-overflow=1 -Wnormalized=id -Woverride-init -Wextra -Warray-bounds -Wlogical-op -MT src/ext/ed25519/ref10/src_ext_ed25519_ref10_libed25519_ref10_a-ge_tobytes.o -MD -MP -MF src/ext/ed25519/ref10/.deps/src_ext_ed25519_ref10_libed25519_ref10_a-ge_tobytes.Tpo -c -o src/ext/ed25519/ref10/src_ext_ed25519_ref10_libed25519_ref10_a-ge_tobytes.o `test -f 'src/ext/ed25519/ref10/ge_tobytes.c' || echo './'`src/ext/ed25519/ref10/ge_tobytes.c

So, somehow that -O2 is getting in there right now?

comment:10 Changed 4 years ago by candrews

Cc: candrews@… added

comment:11 Changed 4 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Fix applied in fcc78e5f8a3249eadfea31db1aca6884b31c1873.

There may be a better fix for the -O2 issue to be found.

Note: See TracTickets for help on using tickets.