1.14.2: Compile errors when using --with-systemd-journal=yes

Aleksander Morgado aleksander at aleksander.es
Fri Sep 18 08:16:00 UTC 2020


> I just did some first testing with the new stable version 1.14.2 (Updating from 1.12.12) and noticed some regressions regarding the support of systemd-journal.

Why is this a regression between 1.14.2 and 1.12.12? IIRC no change
was done in the journal support in MM. What would be the change that
broke it?

> The compilation fails with:
> make[5]: Entering directory '/build/client/3.5.x/freedesktop/modemmanager/work/modemmanager/src'
>   CC       mm-log.lo
> In file included from /build/client/3.5.x/systemd/_/include/systemd/sd-id128.h:23,
>                  from /build/client/3.5.x/systemd/_/include/systemd/sd-journal.h:26,
>                  from mm-log.c:41:
> /build/client/3.5.x/systemd/_/include/systemd/_sd-common.h:76:7: error: "__STDC_VERSION__" is not defined, evaluates to 0 [-Werror=undef]
>  #  if __STDC_VERSION__ >= 199901L
>        ^~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> So it seems that the systemd (246) headers expect __STDC_VERSION__ to be defined.

Wouldn't this be an issue in the systemd headers? i.e. maybe it should
#ifdef __STDC_VERSION__ before using it? I have systemd 246.5  and gcc
10.2.0 in my development machine and my build with systemd journal
support works fine. The builds in the gitlab CI setup also work fine
all of them, and I believe no one else has reported an issue like this
before. So not really sure what's happening here...

> The compiler used is a gcc 8.3.0-6 from debian buster.
> I found two ways to get rid of the problem:
> 1. Avoid the --std=gnu89 flag, this flags causes __STDC_VERSION__ not to be defined. Maybe replacing it with c99.
> 2. Specify the option -Wno-error=undef to avoid aborting the build, leaving it just a warning
> Here some testing I did regarding the gnu89 flag:
> $ gcc -E -dD --std=c99 foo.c|grep STDC_VERSION
> #define __STDC_VERSION__ 199901L
> $ gcc -E -dD --std=gnu89 foo.c|grep STDC_VERSION
> $
> What kind of patch should I provide to fix this problem?

Truth be told, I don't know whether we should patch this, or how we
should do it. I would first like to understand why no one else has
this issue and is only seen in your build setup. Don't take me wrong,
I'm not saying we're not going to fix this because it happened only to
you, I just want to have the whole picture first to see how it should
be best fixed.


More information about the ModemManager-devel mailing list