What minimum version of systemd is actually required for v2.0.0?
Closed this issue · 2 comments
I can't build sdbus-cpp on CentOS 8.
First I checked the system requirements.
The README page says that systemd v236 is needed. The Solving sd-bus dependency page says that the required version is 238.
Ok, let's check my installed versions. Everything looks good:
$ systemctl --version
systemd 239 (239-82.el8)
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=legacy
$ ls /usr/lib64 | grep libsystemd
libsystemd.so
libsystemd.so.0
libsystemd.so.0.23.0
But when I try to build I have the error (reduced some output):
$ cmake .. && make -j
-- The CXX compiler identification is GNU 11.2.1
-- The C compiler identification is GNU 11.2.1
# ...
-- *******************************************
-- * SDBUS-C++ CONFIGURATION *
-- *******************************************
--
-- SDBUSCPP_BUILD_LIBSYSTEMD: OFF
-- SDBUSCPP_INSTALL: ON
-- SDBUSCPP_BUILD_TESTS: OFF
-- SDBUSCPP_BUILD_CODEGEN: OFF
-- SDBUSCPP_BUILD_EXAMPLES: OFF
-- SDBUSCPP_BUILD_DOCS: ON
-- SDBUSCPP_BUILD_DOXYGEN_DOCS: OFF
-- BUILD_SHARED_LIBS: ON
--
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.4.2")
-- Checking for module 'libsystemd>=238'
-- Found libsystemd, version 239
-- Building with libsystemd v239
# ...
-- Configuring done (0.5s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/sdbus-cpp/build
[ 20%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/Message.cpp.o
[ 20%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/Connection.cpp.o
[ 30%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/Object.cpp.o
[ 40%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/Types.cpp.o
[ 50%] Building C object CMakeFiles/sdbus-c++-objlib.dir/src/VTableUtils.c.o
[ 60%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/Error.cpp.o
[ 70%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/Proxy.cpp.o
[ 80%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/Flags.cpp.o
[ 90%] Building CXX object CMakeFiles/sdbus-c++-objlib.dir/src/SdBus.cpp.o
/tmp/sdbus-cpp/src/SdBus.cpp: In member function ‘virtual int sdbus::internal::SdBus::sd_bus_set_method_call_timeout(sd_bus*, uint64_t)’:
/tmp/sdbus-cpp/src/SdBus.cpp:130:139: error: no matching function for call to ‘sdbus::Error::Error(const char [40], const char [86])’
130 | throw sdbus::Error(SD_BUS_ERROR_NOT_SUPPORTED, "Setting general method call timeout not supported by underlying version of libsystemd");
| ^
# ...
# ...
# ...
make[2]: *** [CMakeFiles/sdbus-c++-objlib.dir/build.make:188: CMakeFiles/sdbus-c++-objlib.dir/src/SdBus.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:102: CMakeFiles/sdbus-c++-objlib.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
When checking the source code causing the problem I see that version must be >= 240:
#if LIBSYSTEMD_VERSION>=240
// ...
#else
// ...
throw sdbus::Error(SD_BUS_ERROR_NOT_SUPPORTED, "Setting general method call timeout not supported by underlying version of libsystemd");
#endif
So the question is what version of systemd is actually required by the project?
A little late to the party -- sorry! Thanks for reporting the inconsistency in sd-bus versions. The minimum required version of libsystemd for sdbus-c++ v2.0 is in fact v238. Which your system fulfills. But you could not compile still -- this is not how it should be, all potential problems with libsystemd should be reported upfront during CMake phase. This is a bug in sdbus-c++ that manifests with older sd-bus versions. I fixed both the documentation and the bug in #454. With that, you should be able to build sdbus-c++ against libsystemd v239 on your system (albeit with some extra features provided by later sd-bus versions not available).
When checking the source code causing the problem I see that version must be >= 240:
This is not a hard condition -- there are extra optional features that are conditionally compiled in or left out depending on sd-bus version. So you can freely use sd-bus v239, but you won't have the possibility to set general method call timeout, for example.