Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 662776

Summary: =sys-apps/systemd-239-r1 fails to build against glibc-2.28: error: redefinition of 'struct statx_timestamp'
Product: Gentoo Linux Reporter: Helmut Jarausch <jarausch>
Component: Current packagesAssignee: Gentoo systemd Team <systemd>
Status: RESOLVED FIXED    
Severity: normal CC: ab4bd, alexander, jstein, leonchik1976, mike, teidakankan, toolchain
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=669846
https://bugs.gentoo.org/show_bug.cgi?id=671856
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 663916    
Attachments: 01-statx-glibc-2.28.patch
02-statx-glibc-2.28.patch

Description Helmut Jarausch 2018-08-04 11:37:55 UTC
When re-compiling sys-apps/systemd-239-r1 with sys-kernel/linux-headers-4.17 and glibc-2.28, it fails with a redefinition error:
In file included from ../systemd-239/src/basic/missing.h:18,
                 from ../systemd-239/src/basic/util.h:28,
                 from ../systemd-239/src/basic/architecture.h:7,
                 from ../systemd-239/src/libsystemd/sd-path/sd-path.c:8:
/usr/include/linux/stat.h:18:8: error: redefinition of âstruct statx_timestampâ
 struct statx_timestamp {
        ^~~~~~~~~~~~~~~
In file included from /usr/include/sys/stat.h:446,
                 from ../systemd-239/src/basic/util.h:19,
                 from ../systemd-239/src/basic/architecture.h:7,
                 from ../systemd-239/src/libsystemd/sd-path/sd-path.c:8:
/usr/include/bits/statx.h:25:8: note: originally defined here
 struct statx_timestamp

The kernel itself defines it at

linux-4.17.12-gentoo/include/uapi/linux/stat.h

and not at inux-4.17.12-gentoo/include/linux which should be mirrored by
sys-kernel/linux-headers
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2018-08-06 22:43:01 UTC
systemd includes kernel's headers directly via
    systemd-239/src/basic/missing.h:18
    #include <linux/stat.h>
Normally only libc should do it and libc might define slightly different ABI for structs (they might adhere to a POSIX standard or older kernel ABI).

I believe these two upstream systemd commits should fix it:

  commit 9c869d08d82c73f62ab3527567858ce4b0cf1257
  Author: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
  Date:   Wed Jul 18 17:26:17 2018 +0200

    meson: unify linux/stat.h check with other checks and use _GNU_SOURCE

  commit 75720bff62a84896e9a0654afc7cf9408cf89a38
  Author: Filipe Brandenburger <filbranden@google.com>
  Date:   Sun Jul 15 22:43:35 2018 -0700

    build-sys: Detect whether struct statx is defined in sys/stat.h
Comment 2 milan hodoscek 2018-09-19 08:31:54 UTC
(In reply to Sergei Trofimovich from comment #1)

Got stuck with glibc-2.28 :-( It is possible to downgrade to 2.27 but it is painful so going forward...
For me systemd is one of the 2 critical packages that don't compile/work with glibc-2.28. The other is qtcore


Applied both patches mentioned here and it seems to work so far with systemd-239-r1

did the following for people not so familiar with git/patches/etc..

Assuming logged in as $USER

0. cd ~$USER/Downloads
1. git clone https://github.com/systemd/systemd.git
2. cd systemd
3. git format-patch 75720bff62a84896e9a0654afc7cf9408cf89a38~1..75720bff62a84896e9a0654afc7cf9408cf89a38
4. git format-patch 9c869d08d82c73f62ab3527567858ce4b0cf1257~1..9c869d08d82c73f62ab3527567858ce4b0cf1257
5. su
6. mkdir -p /etc/portage/patches/sys-apps/systemd-239-r1
7. cp ~$USER/Downloads/systemd/0001-* /etc/portage/patches/sys-apps/systemd-239-r1
8. emerge -v1 systemd
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-13 10:18:21 UTC
Created attachment 550960 [details]
01-statx-glibc-2.28.patch
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-13 10:18:39 UTC
Created attachment 550962 [details, diff]
02-statx-glibc-2.28.patch
Comment 5 Larry the Git Cow gentoo-dev 2018-10-28 23:21:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9189edf61c8e135c0cd28be3534d7624cafff239

commit 9189edf61c8e135c0cd28be3534d7624cafff239
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2018-10-28 22:53:46 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2018-10-28 23:21:05 +0000

    sys-apps/systemd: backport several patches for 239
    
    Closes: https://bugs.gentoo.org/662776
    Bug: https://bugs.gentoo.org/669664
    Bug: https://bugs.gentoo.org/669716
    Package-Manager: Portage-2.3.51_p2, Repoman-2.3.11_p27
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-apps/systemd/Manifest              |   1 +
 sys-apps/systemd/systemd-239-r2.ebuild | 448 +++++++++++++++++++++++++++++++++
 2 files changed, 449 insertions(+)
Comment 6 Mike Gilbert gentoo-dev 2018-10-29 02:53:25 UTC
*** Bug 669560 has been marked as a duplicate of this bug. ***