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

Torsten Hilbrich torsten.hilbrich at secunet.com
Thu Sep 17 10:53:07 UTC 2020


Hello,

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.

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.

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?

Thanks,

	Torsten






More information about the ModemManager-devel mailing list