meson: Regression: systemd is failing to compile with clang-{10,11,12} with --optimization=3 -Db_lto=true

Describe the bug Since meson-0.57.0 was released systemd has been failing to compile with --optimization=3 -Db_lto=true with

FAILED: src/basic/libbasic-gcrypt.a.p/gcrypt-util.c.o 
clang-10 -Isrc/basic/libbasic-gcrypt.a.p -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I. -I.. -flto -flto-jobs=0 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=gnu99 -O3 -g -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=undef -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=format=2 -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Werror=overflow -Werror=shift-count-overflow -Wdate-time -Wnested-externs '-Wno-error=#warnings' -Wno-string-plus-int -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-typedef-redefinition -Wno-gnu-variable-sized-type-not-at-end -Werror=shadow -include config.h -Werror -fPIC -fvisibility=default -MD -MQ src/basic/libbasic-gcrypt.a.p/gcrypt-util.c.o -MF src/basic/libbasic-gcrypt.a.p/gcrypt-util.c.o.d -o src/basic/libbasic-gcrypt.a.p/gcrypt-util.c.o -c ../src/basic/gcrypt-util.c
clang: error: argument unused during compilation: '-flto-jobs=0' [-Werror,-Wunused-command-line-argument]
[29/1801] Generating errno-from-name.h with a custom command (wrapped by meson to capture output)
[30/1801] Generating errno-to-name.h with a custom command (wrapped by meson to capture output)
ninja: build stopped: subcommand failed.
+ fatal ''\''meson compile'\'' failed with --optimization=3 -Db_lto=true'
+ echo -e '\033[31;1m'\''meson compile'\'' failed with --optimization=3 -Db_lto=true\033[0m'
'meson compile' failed with --optimization=3 -Db_lto=true
+ exit 1

To Reproduce The script building systemd can be found at https://github.com/systemd/systemd/blob/main/.github/workflows/build_test.sh. It runs something like

git clone https://github.com/systemd/systemd
cd systemd
AR=llvm-ar-10 CFLAGS=-Werror CXXFLAGS=-Werror CC=clang-10 CXX=clang++-10  meson -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true --werror --optimization=3 -Db_lto=true build
ninja -C ./build

I’ve opened https://github.com/systemd/systemd/pull/18590 to “fix” it.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (10 by maintainers)

Commits related to this issue

Most upvoted comments

OSS-Fuzz is not the only massively heterogeneous environment relying on this standard mechanism, and we shouldn’t be shaming them for detecting real bugs in something that meson does specifically support for entirely valid reasons.

@mrc0mmand I think another GH Action should be good enough to more or less cover systemd (though I’d also add OSS-Fuzz builds that always trigger all sorts of issues in meson) but to judge from https://github.com/mesonbuild/meson/issues/8351#issuecomment-780081404 it seems opening PRs against various projects to trigger their CI would be more helpful in general.

We should open a dedicated issue for discussing ci changes, so it doesn’t get lost when this issue is closed