GNU bug report logs - #73793
[PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions

Previous Next

Package: guix-patches;

Reported by: Rutherther <rutherther <at> ditigal.xyz>

Date: Sun, 13 Oct 2024 15:24:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73793 in the body.
You can then email your comments to 73793 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to andreas <at> enge.fr, ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#73793; Package guix-patches. (Sun, 13 Oct 2024 15:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rutherther <rutherther <at> ditigal.xyz>:
New bug report received and forwarded. Copy sent to andreas <at> enge.fr, ludo <at> gnu.org, guix-patches <at> gnu.org. (Sun, 13 Oct 2024 15:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rutherther <rutherther <at> ditigal.xyz>
To: guix-patches <at> gnu.org
Cc: Rutherther <rutherther <at> ditigal.xyz>
Subject: [PATCH] gnu: gcc-9: Fix name conflict for newer glibc versions
Date: Sun, 13 Oct 2024 17:22:36 +0200
Note: not tested yet, I am currently building it locally.

Since newer glibc version there is a conflict in names.
This uses a patch that was used upstream in llvm to bypass it.

* gnu/packages/patches/gcc-9-glibc-name-conflict.patch: Add gcc 9 glibc patch.
* gnu/local.mk: Register it.
* gnu/packages/gcc.scm (gcc-9)[source]: Use it.

Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gcc.scm                          |  3 +-
 .../patches/gcc-9-glibc-name-conflict.patch   | 54 +++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-9-glibc-name-conflict.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3a35bbca37..c1e878587a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1349,6 +1349,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-8-sort-libtool-find-output.patch	\
   %D%/packages/patches/gcc-8-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-9-asan-fix-limits-include.patch	\
+  %D%/packages/patches/gcc-9-glibc-name-conflict.patch	        \
   %D%/packages/patches/gcc-9-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-12-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-10-cross-environment-variables.patch \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c6c7730ad1..b014cee6c1 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -724,7 +724,8 @@ (define-public gcc-10
             (sha256
              (base32
               "1h87lcfaga0ydsf4pkhwlnjr8mky5ix8npbv6iy3jvzlzm1ra415"))
-            (patches (search-patches "gcc-9-strmov-store-file-names.patch"
+            (patches (search-patches "gcc-9-glibc-name-conflict.patch"
+                                     "gcc-9-strmov-store-file-names.patch"
                                      "gcc-5.0-libvtv-runpath.patch"
                                      "gcc-10-libsanitizer-no-crypt.patch"))
             (modules '((guix build utils)))
diff --git a/gnu/packages/patches/gcc-9-glibc-name-conflict.patch b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
new file mode 100644
index 0000000000..3796e86c52
--- /dev/null
+++ b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
@@ -0,0 +1,54 @@
+From b379129c4beb3f26223288627a1291739f33af02 Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i <at> maskray.me>
+Date: Mon, 11 Jul 2022 11:38:28 -0700
+Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve
+ fsconfig_command/mount_attr conflict with glibc 2.36
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It is generally not a good idea to mix usage of glibc headers and Linux UAPI
+headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
+since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
+defines `fsconfig_command` which conflicts with linux/mount.h:
+
+    .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
+
+Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually.
+
+Fix https://github.com/llvm/llvm-project/issues/56421
+
+Reviewed By: #sanitizers, vitalybuka, zatrazz
+
+Differential Revision: https://reviews.llvm.org/D129471
+---
+ .../sanitizer_common/sanitizer_platform_limits_posix.cpp | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+index 4bd425435d56d9..81740bf4ab3948 100644
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -73,7 +73,6 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
+-#include <linux/fs.h>
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -876,10 +875,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;

base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
-- 
2.46.0




Information forwarded to rutherther <at> ditigal.xyz, andreas <at> enge.fr, ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#73793; Package guix-patches. (Sun, 13 Oct 2024 17:12:01 GMT) Full text and rfc822 format available.

Message #8 received at 73793 <at> debbugs.gnu.org (full text, mbox):

From: Rutherther <rutherther <at> ditigal.xyz>
To: 73793 <at> debbugs.gnu.org
Cc: Rutherther <rutherther <at> ditigal.xyz>
Subject: [PATCH v2 0/1] Fixes of the patch for gcc 9
Date: Sun, 13 Oct 2024 19:10:56 +0200
I forgot to change the name guix has in the source from
the one llvm has. Additionally, I also managed to put the
patch to gcc-10 instead of gcc-9. So fixed that as well

The gcc now builds fine for me on x86_64-linux.

Regards,
Rutherther

Rutherther (1):
  gnu: gcc-9: Fix name conflict for newer glibc versions

 gnu/local.mk                                  |  1 +
 gnu/packages/gcc.scm                          |  3 +-
 .../patches/gcc-9-glibc-name-conflict.patch   | 54 +++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-9-glibc-name-conflict.patch


base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
--
2.46.0




Information forwarded to rutherther <at> ditigal.xyz, andreas <at> enge.fr, ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#73793; Package guix-patches. (Sun, 13 Oct 2024 17:12:02 GMT) Full text and rfc822 format available.

Message #11 received at 73793 <at> debbugs.gnu.org (full text, mbox):

From: Rutherther <rutherther <at> ditigal.xyz>
To: 73793 <at> debbugs.gnu.org
Cc: Rutherther <rutherther <at> ditigal.xyz>
Subject: [PATCH v2] gnu: gcc-9: Fix name conflict for newer glibc versions
Date: Sun, 13 Oct 2024 19:10:57 +0200
Since newer glibc version there is a conflict in names.
This uses a patch that was used upstream in llvm to bypass it.

* gnu/packages/patches/gcc-9-glibc-name-conflict.patch: Add gcc 9 glibc patch.
* gnu/local.mk: Register it.
* gnu/packages/gcc.scm (gcc-9)[source]: Use it.

Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gcc.scm                          |  3 +-
 .../patches/gcc-9-glibc-name-conflict.patch   | 54 +++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-9-glibc-name-conflict.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3a35bbca37..c1e878587a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1349,6 +1349,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-8-sort-libtool-find-output.patch	\
   %D%/packages/patches/gcc-8-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-9-asan-fix-limits-include.patch	\
+  %D%/packages/patches/gcc-9-glibc-name-conflict.patch	        \
   %D%/packages/patches/gcc-9-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-12-strmov-store-file-names.patch	\
   %D%/packages/patches/gcc-10-cross-environment-variables.patch \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c6c7730ad1..f3d4985b75 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -705,7 +705,8 @@ (define-public gcc-9
             (sha256
              (base32
               "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7"))
-            (patches (search-patches "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
+            (patches (search-patches "gcc-9-glibc-name-conflict.patch"
+                                     "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
                                      "gcc-13.2.0-libstdc++-info-install-fix.patch"
                                      "gcc-9-strmov-store-file-names.patch"
                                      "gcc-9-asan-fix-limits-include.patch"
diff --git a/gnu/packages/patches/gcc-9-glibc-name-conflict.patch b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
new file mode 100644
index 0000000000..0f398ef136
--- /dev/null
+++ b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
@@ -0,0 +1,54 @@
+From b379129c4beb3f26223288627a1291739f33af02 Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i <at> maskray.me>
+Date: Mon, 11 Jul 2022 11:38:28 -0700
+Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve
+ fsconfig_command/mount_attr conflict with glibc 2.36
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It is generally not a good idea to mix usage of glibc headers and Linux UAPI
+headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
+since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
+defines `fsconfig_command` which conflicts with linux/mount.h:
+
+    .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
+
+Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually.
+
+Fix https://github.com/llvm/llvm-project/issues/56421
+
+Reviewed By: #sanitizers, vitalybuka, zatrazz
+
+Differential Revision: https://reviews.llvm.org/D129471
+---
+ .../sanitizer_common/sanitizer_platform_limits_posix.cpp | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 4bd425435d56d9..81740bf4ab3948 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -73,7 +73,6 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
+-#include <linux/fs.h>
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -876,10 +875,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;

base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
-- 
2.46.0




Information forwarded to guix-patches <at> gnu.org:
bug#73793; Package guix-patches. (Mon, 14 Oct 2024 12:41:03 GMT) Full text and rfc822 format available.

Message #14 received at 73793 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Rutherther <rutherther <at> ditigal.xyz>
Cc: Andreas Enge <andreas <at> enge.fr>, 73793 <at> debbugs.gnu.org
Subject: Re: [bug#73793] [PATCH] gnu: gcc-9: Fix name conflict for newer
 glibc versions
Date: Mon, 14 Oct 2024 13:52:48 +0200
Rutherther <rutherther <at> ditigal.xyz> skribis:

> Note: not tested yet, I am currently building it locally.
>
> Since newer glibc version there is a conflict in names.
> This uses a patch that was used upstream in llvm to bypass it.
>
> * gnu/packages/patches/gcc-9-glibc-name-conflict.patch: Add gcc 9 glibc patch.
> * gnu/local.mk: Register it.
> * gnu/packages/gcc.scm (gcc-9)[source]: Use it.
>
> Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed

[...]

> +++ b/gnu/packages/patches/gcc-9-glibc-name-conflict.patch
> @@ -0,0 +1,54 @@
> +From b379129c4beb3f26223288627a1291739f33af02 Mon Sep 17 00:00:00 2001
> +From: Fangrui Song <i <at> maskray.me>
> +Date: Mon, 11 Jul 2022 11:38:28 -0700
> +Subject: [PATCH] [sanitizer] Remove #include <linux/fs.h> to resolve
> + fsconfig_command/mount_attr conflict with glibc 2.36
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +It is generally not a good idea to mix usage of glibc headers and Linux UAPI
> +headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
> +since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
> +defines `fsconfig_command` which conflicts with linux/mount.h:
> +
> +    .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’

Instead of this new patch, could you check whether
‘gcc-7-libsanitizer-fsconfig-command.patch’ applies?

If not, could you make sure the new patch has a name similar to the
other ones in this area and a similar header?

Thanks in advance,
Ludo’.




Information forwarded to rutherther <at> ditigal.xyz, ludo <at> gnu.org, andreas <at> enge.fr, guix-patches <at> gnu.org:
bug#73793; Package guix-patches. (Mon, 14 Oct 2024 18:02:02 GMT) Full text and rfc822 format available.

Message #17 received at 73793 <at> debbugs.gnu.org (full text, mbox):

From: Rutherther <rutherther <at> ditigal.xyz>
To: 73793 <at> debbugs.gnu.org
Cc: ludo <at> gnu.org, Rutherther <rutherther <at> ditigal.xyz>
Subject: [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch
Date: Mon, 14 Oct 2024 20:00:28 +0200
Since newer glibc version there is a conflict in names
between kernel module and glibc module.
This uses a patch that was used upstream in llvm to bypass it.
Without this, the build fails with a redefinition error.

* gnu/packages/gcc.scm: Add gcc-7-libsanitizer-fsconfig-command.patch.

Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed
---
 gnu/packages/gcc.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c6c7730ad1..c9e475b676 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -705,7 +705,8 @@ (define-public gcc-9
             (sha256
              (base32
               "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7"))
-            (patches (search-patches "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
+            (patches (search-patches "gcc-7-libsanitizer-fsconfig-command.patch"
+                                     "gcc-13.2.0-libstdc++-docbook-xsl-uri.patch"
                                      "gcc-13.2.0-libstdc++-info-install-fix.patch"
                                      "gcc-9-strmov-store-file-names.patch"
                                      "gcc-9-asan-fix-limits-include.patch"

base-commit: 8f0d76152a4496960f4c2ec219839c5a48b0568e
-- 
2.46.0




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 15 Oct 2024 15:58:03 GMT) Full text and rfc822 format available.

Notification sent to Rutherther <rutherther <at> ditigal.xyz>:
bug acknowledged by developer. (Tue, 15 Oct 2024 15:58:03 GMT) Full text and rfc822 format available.

Message #22 received at 73793-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Rutherther <rutherther <at> ditigal.xyz>
Cc: 73793-done <at> debbugs.gnu.org
Subject: Re: [PATCH v3] gnu: gcc-9: Add libsanitizer fsconfig command patch
Date: Tue, 15 Oct 2024 17:45:46 +0200
Rutherther <rutherther <at> ditigal.xyz> skribis:

> Since newer glibc version there is a conflict in names
> between kernel module and glibc module.
> This uses a patch that was used upstream in llvm to bypass it.
> Without this, the build fails with a redefinition error.
>
> * gnu/packages/gcc.scm: Add gcc-7-libsanitizer-fsconfig-command.patch.
>
> Change-Id: Ibb8446b7bba52f72d82fcf69804cae09215daeed

I tweaked the commit log to clarify which entities are changed.

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 13 Nov 2024 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.