[Buildroot] [PATCH 1/1] package/glibc: fix fsconfig_command redeclaration bug

Peter Seiderer ps.report at gmx.net
Tue Oct 4 06:59:22 UTC 2022


Hello *,

On Sun, 2 Oct 2022 09:40:28 +0200, "Yann E. MORIN" <yann.morin.1998 at free.fr> wrote:

[...]  
> 
> Yes, we really need to understand why it is broken in the first place,
> to evaluate whether your patch is correct, or whether we should change
> the way we do things in Buildroot. Hint: I think we do something in
> Buildroot that is wrong (or has become wrong as time passed), but we
> could not pinpoint it yet...
> 
> > >To be noted, and as Thomas noticed, OpenEmbeded is also using a glibc
> > >2.36 commit, and even one older than ours, but they do not seem to have
> > >issues.  
> > 

With buildroot raspberrypi4_64_defconfig:

  In file included from .../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/linux/fs.h:19,
                   from ../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:75:
  .../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/linux/mount.h:92:6: error: multiple definition of ‘enum fsconfig_command’
     92 | enum fsconfig_command {
        |      ^~~~~~~~~~~~~~~~
  In file included from ../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:62:
.../build/host-gcc-final-11.3.0/build/gcc/include-fixed/sys/mount.h:249:6: note: previous definition here
    249 | enum fsconfig_command
        |      ^~~~~~~~~~~~~~~~


Note the 'include-fixed' path, so diff the original vs. the fixed:

	$ diff -u .../sysroot/usr/include/sys/mount.h /home/seiderer/Work/Buildroot/build_rpi4_64_glibc_001/build/host-gcc-final-11.3.0/build/gcc/include-fixed/sys/mount.h | cat
--- .../sysroot/usr/include/sys/mount.h	2022-10-03 16:17:15.934642586 +0200
+++ .../build/host-gcc-final-11.3.0/build/gcc/include-fixed/sys/mount.h	2022-10-03 16:20:35.862882930 +0200
@@ -1,3 +1,12 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	".../sysroot/usr/include/sys/mount.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
 /* Header file for mounting/unmount Linux filesystems.
    Copyright (C) 1996-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
@@ -28,7 +37,7 @@
 #include <sys/ioctl.h>
 
 #ifdef __has_include
-# if __has_include ("linux/mount.h")
+# if __has_include ("__linux__/mount.h")
 #  include "linux/mount.h"
 # endif
 #endif

After changing back the line

	# if __has_include ("__linux__/mount.h")

to

	# if __has_include ("linux/mount.h")

the build succeeds...

Seems gcc fixincl does not handle the '# if __has_include' pattern the right way...

Same for all other '__has_include' usages:

	$ grep -R __has_include build/host-gcc-final-11.3.0/build/gcc/include-fixed/
build/host-gcc-final-11.3.0/build/gcc/include-fixed/bits/unistd_ext.h:#ifdef __has_include
build/host-gcc-final-11.3.0/build/gcc/include-fixed/bits/unistd_ext.h:# if __has_include ("__linux__/close_range.h")
build/host-gcc-final-11.3.0/build/gcc/include-fixed/bits/statx.h:   __has_include argument (GCC PR 80005).  */
build/host-gcc-final-11.3.0/build/gcc/include-fixed/bits/statx.h:#ifdef __has_include
build/host-gcc-final-11.3.0/build/gcc/include-fixed/bits/statx.h:# if __has_include ("__linux__/stat.h")
build/host-gcc-final-11.3.0/build/gcc/include-fixed/sys/mount.h:#ifdef __has_include
build/host-gcc-final-11.3.0/build/gcc/include-fixed/sys/mount.h:# if __has_include ("__linux__/mount.h")
build/host-gcc-final-11.3.0/build/gcc/include-fixed/sys/rseq.h:#ifdef __has_include
build/host-gcc-final-11.3.0/build/gcc/include-fixed/sys/rseq.h:# if __has_include ("__linux__/rseq.h")


Regards,
Peter




More information about the buildroot mailing list