Skip to contentSkip to conversation

package/systemd: fix statx support with glibc >= 2.28

PATCH New Romain Naour 4 participants 8 messages Aug 3, 2018 – Aug 25, 2018 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/systemd: fix statx support with glibc >= 2.28

Backport 2 patches fixing statix redefinition:

In file included from ../src/basic/missing.h:18,

     from ../src/basic/util.h:28,
     from ../src/basic/hashmap.h:10,
     from ../src/shared/bus-util.h:12,
     from ../src/libsystemd/sd-bus/bus-creds.c:11:
     /usr/include/linux/stat.h:99:8: error: redefinition of ?struct statx?
---
 ...etect-whether-struct-statx-is-defined-in-.patch | 111 +++++++++++++++++++++
 ...-linux-stat.h-check-with-other-checks-and.patch |  77 ++++++++++++++
 2 files changed, 188 insertions(+)
 create mode 100644 package/systemd/0003-build-sys-Detect-whether-struct-statx-is-defined-in-.patch
 create mode 100644 package/systemd/0004-meson-unify-linux-stat.h-check-with-other-checks-and.patch
package/systemd/0003-build-sys-Detect-whether-struct-statx-is-defined-in-.patch new file +111 -0
new file mode 100644
index 0000000000..df67eed9d8
@@ -0,0 +1,111 @@
+From ebe5606eadb1241796ba9747d8e357bd6b3e912e Mon Sep 17 00:00:00 2001
+From: Filipe Brandenburger <[email protected]>
+Date: Sun, 15 Jul 2018 22:43:35 -0700
+Subject: [PATCH 3/4] build-sys: Detect whether struct statx is defined in
+ sys/stat.h
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
+definition for struct statx, in which case include file linux/stat.h should be
+avoided, in order to prevent a duplicate definition.
+
+    In file included from ../src/basic/missing.h:18,
+		     from ../src/basic/util.h:28,
+		     from ../src/basic/hashmap.h:10,
+		     from ../src/shared/bus-util.h:12,
+		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
+    /usr/include/linux/stat.h:99:8: error: redefinition of ?struct statx?
+     struct statx {
+	    ^~~~~
+    In file included from /usr/include/sys/stat.h:446,
+		     from ../src/basic/util.h:19,
+		     from ../src/basic/hashmap.h:10,
+		     from ../src/shared/bus-util.h:12,
+		     from ../src/libsystemd/sd-bus/bus-creds.c:11:
+    /usr/include/bits/statx.h:36:8: note: originally defined here
+     struct statx
+	    ^~~~~
+
+Extend our meson.build to look for struct statx when only sys/stat.h is
+included and, in that case, do not include linux/stat.h anymore.
+
+Tested that systemd builds correctly when using a glibc version that includes a
+definition for struct statx.
+
+glibc Fedora RPM update:
+https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae
+
+glibc upstream commit:
+https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
+
+(cherry picked from commit 75720bff62a84896e9a0654afc7cf9408cf89a38)
+Signed-off-by: Romain Naour <[email protected]>
+---
+ meson.build            | 5 +++++
+ src/basic/missing.h    | 5 ++++-
+ src/basic/xattr-util.c | 1 -
+ 3 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 04331dd41..a0e724070 100644
+--- a/meson.build
++++ b/meson.build
+@@ -425,6 +425,7 @@ decl_headers = '''
+ #include <sys/stat.h>
+ '''
+ # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
++# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time
+ 
+ foreach decl : ['char16_t',
+                 'char32_t',
+@@ -439,6 +440,10 @@ foreach decl : ['char16_t',
+         conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
+ endforeach
+ 
++conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : '''
++#include <sys/stat.h>
++''', args : '-D_GNU_SOURCE') > 0)
++
+ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE',         'linux/if_link.h'],
+                 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
+                 ['IFLA_VRF_TABLE',                   'linux/if_link.h'],
+diff --git a/src/basic/missing.h b/src/basic/missing.h
+index 71a07d057..14ad3d491 100644
+--- a/src/basic/missing.h
++++ b/src/basic/missing.h
+@@ -15,7 +15,6 @@
+ #include <linux/neighbour.h>
+ #include <linux/oom.h>
+ #include <linux/rtnetlink.h>
+-#include <linux/stat.h>
+ #include <net/ethernet.h>
+ #include <stdlib.h>
+ #include <sys/resource.h>
+@@ -25,6 +24,10 @@
+ #include <uchar.h>
+ #include <unistd.h>
+ 
++#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H
++#include <linux/stat.h>
++#endif
++
+ #if HAVE_AUDIT
+ #include <libaudit.h>
+ #endif
+diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c
+index c5c55ea84..0ee097983 100644
+--- a/src/basic/xattr-util.c
++++ b/src/basic/xattr-util.c
+@@ -2,7 +2,6 @@
+ 
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <linux/stat.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+-- 
+2.14.4
+
package/systemd/0004-meson-unify-linux-stat.h-check-with-other-checks-and.patch new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.14.4
#1 lore raw

PATCH 2/2 package/glibc: bump to version 2.28

https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html

---
 package/glibc/glibc.hash | 2 +-
 package/glibc/glibc.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/glibc/glibc.hash +1 -1
index 81dd5ad5ed..85afd6fd6b 100644
@@ -1,5 +1,5 @@
 # Locally calculated (fetched from Github)
-sha256  33189b3f10c88730a1f686fac794bc01f31765f12ffd75bc5e8a0f2a690d217a     glibc-glibc-2.27-57-g6c99e37f6fb640a50a3113b2dbee5d5389843c1e.tar.gz
+sha256  877c7b4741501d1762af8ef1a2518bdf2d722947d2e8d48b203e2d83cc600bca     glibc-glibc-2.28.tar.gz
 # Locally calculated (fetched from Github)
 sha256  e08ab67b2db2d0f0e8f3311d23c54fb8f6d4c1ef6fa0b4047fd5da400e3ce9de     glibc-arc-2018.03-release.tar.gz
 
package/glibc/glibc.mk +1 -1
index d34b42b831..399cf395ce 100644
@@ -10,7 +10,7 @@ GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VE
 else
 # Generate version string using:
 #   git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master
-GLIBC_VERSION = glibc-2.27-57-g6c99e37f6fb640a50a3113b2dbee5d5389843c1e
+GLIBC_VERSION = glibc-2.28
 # Upstream doesn't officially provide an https download link.
 # There is one (https://sourceware.org/git/glibc.git) but it's not reliable,
 # sometimes the connection times out. So use an unofficial github mirror.
Signature · 1 line
2.14.4
#2 lore raw

PATCH 2/2 package/glibc: bump to version 2.28

Hello,

Quoted 7 lines · Romain Naour

https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html

---
 package/glibc/glibc.hash | 2 +-
 package/glibc/glibc.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied to next, thanks. Please monitor the autobuilders at
http://autobuild.buildroot.net/?branch=next&status=NOK&libc=glibc in the next few days for build failures related to glibc 2.28, I'm sure there will be some :-)

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 2/2 package/glibc: bump to version 2.28

In reply to Romain Naour

Hi Romain,

Quoted 1 line · Romain Naour

https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html

This announcement says:

GNU make 4.0 or later is now required to build glibc.

autobuilders now show that:

http://autobuild.buildroot.net/?reason=glibc-glibc-2.28

Since glibc is a fundamental package, does that mean we need to bump the make version requirement to 4.0 (current requirement is 3.81)? Maybe build host-make on older hosts?

baruch

Quoted 30 lines
---
 package/glibc/glibc.hash | 2 +-
 package/glibc/glibc.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/glibc/glibc.hash +1 -1
index 81dd5ad5ed..85afd6fd6b 100644
@@ -1,5 +1,5 @@
 # Locally calculated (fetched from Github)
-sha256  33189b3f10c88730a1f686fac794bc01f31765f12ffd75bc5e8a0f2a690d217a     glibc-glibc-2.27-57-g6c99e37f6fb640a50a3113b2dbee5d5389843c1e.tar.gz
+sha256  877c7b4741501d1762af8ef1a2518bdf2d722947d2e8d48b203e2d83cc600bca     glibc-glibc-2.28.tar.gz
 # Locally calculated (fetched from Github)
 sha256  e08ab67b2db2d0f0e8f3311d23c54fb8f6d4c1ef6fa0b4047fd5da400e3ce9de     glibc-arc-2018.03-release.tar.gz
 
package/glibc/glibc.mk +1 -1
index d34b42b831..399cf395ce 100644
@@ -10,7 +10,7 @@ GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VE
 else
 # Generate version string using:
 #   git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master
-GLIBC_VERSION = glibc-2.27-57-g6c99e37f6fb640a50a3113b2dbee5d5389843c1e
+GLIBC_VERSION = glibc-2.28
 # Upstream doesn't officially provide an https download link.
 # There is one (https://sourceware.org/git/glibc.git) but it's not reliable,
 # sometimes the connection times out. So use an unofficial github mirror.
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#4 lore raw

PATCH 2/2 package/glibc: bump to version 2.28

Hello,

Quoted 7 lines · Baruch Siach
Quoted 1 line · Romain Naour

https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html

This announcement says:

GNU make 4.0 or later is now required to build glibc.

Quoted 7 lines

autobuilders now show that:

http://autobuild.buildroot.net/?reason=glibc-glibc-2.28

Since glibc is a fundamental package, does that mean we need to bump the make version requirement to 4.0 (current requirement is 3.81)? Maybe build host-make on older hosts?

Building host-make on machines that don't have make >= 4.0 sounds like a good approach to me. And of course, we only do this as a dependency of glibc.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH 2/2 package/glibc: bump to version 2.28

Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 11 lines · Baruch Siach
Quoted 1 line · Romain Naour

https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html

This announcement says:

GNU make 4.0 or later is now required to build glibc.

autobuilders now show that:

http://autobuild.buildroot.net/?reason=glibc-glibc-2.28

Quoted 7 lines
Quoted 3 lines

Since glibc is a fundamental package, does that mean we need to bump the make version requirement to 4.0 (current requirement is 3.81)? Maybe build host-make on older hosts?

Building host-make on machines that don't have make >= 4.0 sounds like a good approach to me. And of course, we only do this as a dependency of glibc.

Agreed, it is imho too early to require make >= 4.0 globally.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 2/2 package/glibc: bump to version 2.28

Hi Baruch, Peter,

Le 15/08/2018 ? 21:16, Peter Korsgaard a ?crit?:

Quoted 20 lines
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 14 lines · Baruch Siach
Quoted 1 line · Romain Naour

https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html

This announcement says:

GNU make 4.0 or later is now required to build glibc.

autobuilders now show that:

http://autobuild.buildroot.net/?reason=glibc-glibc-2.28

Since glibc is a fundamental package, does that mean we need to bump the make version requirement to 4.0 (current requirement is 3.81)? Maybe build host-make on older hosts?

Quoted 6 lines
Quoted 3 lines

Building host-make on machines that don't have make >= 4.0 sounds like a good approach to me. And of course, we only do this as a dependency of glibc.

Agreed, it is imho too early to require make >= 4.0 globally.

Thanks Baruch for noticing this new dependency added by [1].

I'll take a look how to do this.

Best regards,
Romain

[1]
https://sourceware.org/git/?p=glibc.git;a=commit;h=f2873d2da0ac9802e0b570e8e0b9e7e04a82bf55

#7 lore raw

PATCH 1/2 package/systemd: fix statx support with glibc >= 2.28

In reply to Romain Naour

Hello Romain,

Quoted 1 line · Romain Naour

Backport 2 patches fixing statix redefinition:

                            ^^^^^ statx

Review

Quoted 5 lines
(quoted diff) +4 -0
+Subject: [PATCH 3/4] build-sys: Detect whether struct statx is defined in
+ sys/stat.h
 
+Subject: [PATCH 4/4] meson: unify linux/stat.h check with other checks and use
+ _GNU_SOURCE

Please generate your patches with git format-patch -N to avoid the numbering in the patch titles.

I've applied to next after fixing those two minor issues. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com