Closed lucasdietrich closed 4 months ago
I just ran into this as well.
@lucasdietrich @ColdForest Thanks for the report. I guess moving libcgroup/systemd.h
out of #ifdef WITH_SYSTEMD
into nobase_
will be a partial fix if libcgroup/systemd.h
is to be included unconditionally in the include/Makefile.am
. Additionally, it would require WITH_SYSTEMD=n
version of functions included from libcgroup/systemd.h
for graceful errors, instead of build failures. The function would return an error message, along with ECGROUPNOTCOMPILED?
as the return value.
Another approach would be to use #ifdef WITH_SYSTEMD
while adding libcgroup/systemd.h
in libcgroup.h
but that would require moving out the systemd
configuration parser functions to out of libcgroup/systemd.h
, but that doesn't sound like a great option.
I'm encountering the same issue as well. Here is the log:
# gcc -o get_mount_point get_mount_point.c -lcgroup
In file included from get_mount_point.c:2:0:
/usr/include/libcgroup.h:22:31: fatal error: libcgroup/systemd.h: No such file or directory
#include <libcgroup/systemd.h>
^
compilation terminated.
#
Is there any available fix for this?
@lucasdietrich @ColdForest @Sangeetha-E Can you please give #414 a try?
I just tested your changes in my Yocto project, and everything compiled without error. The issue seems to be resolved on my side, thank you !
Steps:
@lucasdietrich Thank you so much for the super quick testing. Can I include your name and email (please share) in the Reported-by:
tag.
Sure Reported-by: Lucas Dietrich <lucas.dietrich@socomec.com>
File include/Makefile.am conditionally instructs to not install systemd.h header depending on systemd feature, however header include/libcgroup.h unconditionally includes this previous header.
I'm compiling this library in the context of a Yocto environement, if I build libcgroup with
--enable-systemd=no
, systemd.h header is not installed in the development package, when including<libcgroup.h>
from a C project this causes a gcc error saying it cannot findsystemd.h
headerMoving
libcgroup/systemd.h
tonobase_include_HEADERS
ininclude/Makefile.am
solves our issue:Is this a indented ? I can elaborate a patch