Bug 2044656 - gcc-12 causes grub2 build failure on ppc64le
Summary: gcc-12 causes grub2 build failure on ppc64le
Keywords:
Status: CLOSED DUPLICATE of bug 2045456
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: rawhide
Hardware: ppc64le
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Javier Martinez Canillas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2045456
TreeView+ depends on / blocked
 
Reported: 2022-01-24 22:02 UTC by Robbie Harwood
Modified: 2022-01-27 14:52 UTC (History)
22 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-01-27 14:52:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Robbie Harwood 2022-01-24 22:02:43 UTC
(I know it's more convenient to have processed, isolated source for these, but I lack ppc64le machines to create that.)

grub2 currently fails to build on ppc64le: https://koji.fedoraproject.org/koji/taskinfo?taskID=81557827

(In order to prove that it's not the update itself, I ran a scratch build of the previous, working version that failed in the same way: https://koji.fedoraproject.org/koji/taskinfo?taskID=81778377 )

This doesn't look like any of the failures I've seen reported so far, but apologies if I've missed something.  It gets unhappy about stdio.h:

gcc -DHAVE_CONFIG_H -I. -I../../../../grub-core/lib/gnulib -I../../..  -I/builddir/build/BUILD/grub-2.06/grub-powerpc-ieee1275-2.06 -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I../../../include -D_GLIBCXX_ASSERTIONS   -std=gnu99 	 -fno-strict-aliasing -fno-strict-aliasing -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS  -mcpu=power6 -mtune=power8 -fstack-clash-protection -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Wextra -Werror=trampolines -fno-trampolines -fexceptions -fstack-protector-strong -fno-strict-aliasing -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wp,-D_GLIBCXX_ASSERTIONS -Wp,-DGNULIB_STRICT_CHECKING=1 -W -Wall -Wextra -Wno-undef -Wno-missing-field-initializers -Wno-unused-parameter -Werror -Wno-error=vla -Wno-error=type-limits -Werror=format-security -Werror=trampolines -Wno-error=format-nonliteral -Wno-error=cast-align   -c -o uniwidth/width.o ../../../../grub-core/lib/gnulib/uniwidth/width.c
In file included from /usr/include/stdio.h:899,
                 from ./stdio.h:43,
                 from ../../../../grub-core/lib/gnulib/regex_internal.h:25,
                 from ../../../../grub-core/lib/gnulib/regex.c:68:
/usr/include/bits/stdio-ldbl.h: In function '__LDBL_REDIR1_DECL':
/usr/include/bits/stdio-ldbl.h:36:1: error: expected declaration specifiers before '__LDBL_REDIR1_DECL'
   36 | __LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
      | ^~~~~~~~~~~~~~~~~~
In file included from ./stdio.h:53:
/usr/lib/gcc/ppc64le-redhat-linux/12/include/stddef.h:145:26: error: storage class specified for parameter 'ptrdiff_t'
  145 | typedef __PTRDIFF_TYPE__ ptrdiff_t;
      |                          ^~~~~~~~~
/usr/lib/gcc/ppc64le-redhat-linux/12/include/stddef.h:329:24: error: storage class specified for parameter 'wchar_t'
  329 | typedef __WCHAR_TYPE__ wchar_t;
      |                        ^~~~~~~
./stdio.h:734:1: error: storage class specified for parameter '_gl_cxxalias_dummy'
  734 | _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
      | ^~~~~~~~~~~~~~~~

(and keeps going in that vein for quite a while).

Comment 1 Jakub Jelinek 2022-01-27 10:41:00 UTC
That looks like either a glibc issue or the package redefining some macros glibc relies on.

Comment 2 Florian Weimer 2022-01-27 12:10:03 UTC
gnulib has a copy of <sys/cdefs.h>, and it overrides the system version completely in some cases. grub2 needs to update its copy. This gnulib commit looks relevant:

commit 776af40e09b476a41073131a90022572f448c189
Author: Paul Eggert <eggert.edu>
Date:   Tue Jan 5 13:12:39 2021 -0800

    libc-config: merge from glibc
    
    Use a better way of keeping glibc <sys/cdefs.h> and gnulib
    lib/cdefs.h mostly in sync, by using lib/cdefs.h only on platforms
    where <sys/cdefs.h> does not work well enough for Gnulib.
    * lib/cdefs.h: Go back to using _SYS_CDEFS_H rather than
    _GL_DEFS_H as an include guard.
    (__THROW, __THROWNL, __NTH, __NTHNL):
    Define to noexcept for C++11 and later.
    (__glibc_objsize, __glibc_objsize0): New, for _FORTIFY_SOURCE=3.
    (__warndecl): Remove.
    (__attribute_copy__): New macro, for GCC 9 support.
    (__LDBL_REDIR, __LDBL_REDIR_DECL, __LDBL_REDIR1)
    (__LDBL_REDIR1_DECL, __LDBL_REDIR1_NTH, __REDIRECT_NTH_LDBL)
    (__REDIRECT_LDBL, __LDBL_REDIR_NTH):
    Redirections for IEEE long double on powerpc64le.
    (__LDBL_REDIR2_DECL): New macro.
    (__attr_access): New macro, for GCC 10 bounds checking.
    (__attribute_returns_twice__): New macro, for setjmp etc.
    * lib/libc-config.h: Include <cdefs.h> only if __glibc_likely is
    undefined.  The following changes apply only if __glibc_likely
    is not defined.
    (__LDBL_REDIR2_DECL, __attr_access, __attribute_returns_twice__)
    (__glibc_clang_has_attribute, __glibc_clang_has_extension)
    (__glibc_objsize, __glibc_objsize0):
    Undef these new (or newer) <cdefs.h> macros.
    (__P, __PMT, __always_inline): Do not undef, since cdefs.h does that.
    (__glibc_likely): Do not undef, since this is inside
    ifndef __glibc_likely.
    (__warndecl): Do not undef; no longer defined.

Of course what gnulib is doing is completely invalid and undefined, but it is what it is.

Comment 3 Robbie Harwood 2022-01-27 14:52:09 UTC
Thanks for looking.  Really dislike gnulib...

*** This bug has been marked as a duplicate of bug 2045456 ***


Note You need to log in before you can comment on or make changes to this bug.