gcccentos7gcc14

error: unknown type name ‘max_align_t’ when building GCC 14.2 for centos7


I am building gcc 14.2.0 from source for centos7 and ran into the following issue with gettext during the make process. I plan to use the recent C++ compilers that comes with gcc 14.

gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../../gcc-14.2.0/gettext/gettext-runtime/gnulib-lib -I..  -I../intl -I../../../gcc-14.2.0/gettext/gettext-runtime/intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1   -Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter -Wno-pedantic -Wno-sign-conversion -Wno-type-limits -Wno-unsuffixed-float-constants -g -c -o unistr/libgrt_a-u8-uctomb.o `test -f 'unistr/u8-uctomb.c' || echo '../../../gcc-14.2.0/gettext/gettext-runtime/gnulib-lib/'`unistr/u8-uctomb.c
In file included from ../../../gcc-14.2.0/gettext/gettext-runtime/gnulib-lib/scratch_buffer.h:115:0,
                 from ../../../gcc-14.2.0/gettext/gettext-runtime/gnulib-lib/malloc/scratch_buffer_grow.c:23:
./malloc/scratch_buffer.gl.h:70:9: error: unknown type name ‘max_align_t’
   union { max_align_t __align; char __c[1024]; } __space;
         ^

My gettext vesion is

# gettext --version
gettext (GNU gettext-runtime) 0.22
Copyright (C) 1995-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Ulrich Drepper.

This is how I tried to build it

yum groupinstall -y "Development Tools"
yum install -y wget bzip2 tar

GCC_VERSION=14.2.0
wget https://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz
tar -xvzf gcc-$GCC_VERSION.tar.gz
cd gcc-$GCC_VERSION

./contrib/download_prerequisites
mkdir ../gcc-build
cd ../gcc-build
../gcc-$GCC_VERSION/configure --enable-languages=c,c++ --disable-multilib

make -j$(nproc)
make install

Could someone kindly help me out to install gcc 14? Is there any way to solve this issue?


Solution

  • I'm not able to add comment yet, so I write reply here instead. Sorry for the inconvenience.

    This GCC Bugzilla bug report matches your question. In brief, Arsen Arsenović made a patch to work around it and proved it's working. You can find the patch at GCC Bugzilla or at sourceware mailing list.

    EDIT: I updated the patch to match GCC 14.2.0 release. The original one was for r14-5424-gdb50aea6259545.

    The patch content:

    diff --git a/Makefile.def b/Makefile.def
    index 19954e7..d25edb6 100644
    --- a/Makefile.def
    +++ b/Makefile.def
    @@ -76,6 +76,8 @@ host_modules= { module= gprof; };
     host_modules= { module= gprofng; };
     host_modules= { module= gettext; bootstrap=true; no_install=true;
                     module_srcdir= "gettext/gettext-runtime";
    +               // Don't override configure-discovered build arguments
    +               all_args_override="";
                    // We always build gettext with pic, because some packages (e.g. gdbserver)
                    // need it in some configuratons, which is determined via nontrivial tests.
                    // Always enabling pic seems to make sense for something tied to
    diff --git a/Makefile.in b/Makefile.in
    index db4fa6c..f71f515 100644
    --- a/Makefile.in
    +++ b/Makefile.in
    @@ -3174,6 +3174,8 @@ TAGS: do-TAGS
     
     
     
    +
    +
     # --------------------------------------
     # Modules which run on the build machine
     # --------------------------------------
    @@ -20195,7 +20197,7 @@ all-gettext: configure-gettext
            s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
            $(HOST_EXPORTS)  \
            (cd $(HOST_SUBDIR)/gettext && \
    -         $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
    +         $(MAKE) $(BASE_FLAGS_TO_PASS)  $(STAGE1_FLAGS_TO_PASS)  \
                    $(TARGET-gettext))
     @endif gettext
     
    @@ -20225,7 +20227,7 @@ all-stage1-gettext: configure-stage1-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS)  \
    +                 \
                    $(STAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGE1_TFLAGS)"  \
                    $(TARGET-stage1-gettext)
    @@ -20240,7 +20242,7 @@ clean-stage1-gettext:
              $(MAKE) stage1-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS)  \
    +       $(MAKE)   \
            $(STAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
    @@ -20270,7 +20272,7 @@ all-stage2-gettext: configure-stage2-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGE2_TFLAGS)"  \
                    $(TARGET-stage2-gettext)
     
    @@ -20284,7 +20286,7 @@ clean-stage2-gettext:
              $(MAKE) stage2-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    @@ -20313,7 +20315,7 @@ all-stage3-gettext: configure-stage3-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGE3_TFLAGS)"  \
                    $(TARGET-stage3-gettext)
     
    @@ -20327,7 +20329,7 @@ clean-stage3-gettext:
              $(MAKE) stage3-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    @@ -20356,7 +20358,7 @@ all-stage4-gettext: configure-stage4-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGE4_TFLAGS)"  \
                    $(TARGET-stage4-gettext)
     
    @@ -20370,7 +20372,7 @@ clean-stage4-gettext:
              $(MAKE) stage4-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    @@ -20399,7 +20401,7 @@ all-stageprofile-gettext: configure-stageprofile-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGEprofile_TFLAGS)"  \
                    $(TARGET-stageprofile-gettext)
     
    @@ -20413,7 +20415,7 @@ clean-stageprofile-gettext:
              $(MAKE) stageprofile-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    @@ -20442,7 +20444,7 @@ all-stagetrain-gettext: configure-stagetrain-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGEtrain_TFLAGS)"  \
                    $(TARGET-stagetrain-gettext)
     
    @@ -20456,7 +20458,7 @@ clean-stagetrain-gettext:
              $(MAKE) stagetrain-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    @@ -20485,7 +20487,7 @@ all-stagefeedback-gettext: configure-stagefeedback-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGEfeedback_TFLAGS)"  \
                    $(TARGET-stagefeedback-gettext)
     
    @@ -20499,7 +20501,7 @@ clean-stagefeedback-gettext:
              $(MAKE) stagefeedback-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    @@ -20528,7 +20530,7 @@ all-stageautoprofile-gettext: configure-stageautoprofile-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGEautoprofile_TFLAGS)"  \
                    $(TARGET-stageautoprofile-gettext)
     
    @@ -20542,7 +20544,7 @@ clean-stageautoprofile-gettext:
              $(MAKE) stageautoprofile-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    @@ -20571,7 +20573,7 @@ all-stageautofeedback-gettext: configure-stageautofeedback-gettext
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
    +                $(POSTSTAGE1_FLAGS_TO_PASS)  \
                    TFLAGS="$(STAGEautofeedback_TFLAGS)" PERF_DATA=perf.data \
                    $(TARGET-stageautofeedback-gettext)
     
    @@ -20585,7 +20587,7 @@ clean-stageautofeedback-gettext:
              $(MAKE) stageautofeedback-start; \
            fi; \
            cd $(HOST_SUBDIR)/gettext && \
    -       $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
    +       $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
     @endif gettext-bootstrap
     
     
    diff --git a/Makefile.tpl b/Makefile.tpl
    index 1d5813c..dd3ec65 100644
    --- a/Makefile.tpl
    +++ b/Makefile.tpl
    @@ -1261,6 +1261,8 @@ configure-stage[+id+]-[+prefix+][+module+]:
     [+ ENDIF bootstrap +]
     [+ ENDDEF +]
     
    +[+ DEFINE all--args +][+ (get "all_args_override" (get "args")) +][+ ENDDEF +]
    +
     [+ DEFINE all +]
     .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
     maybe-all-[+prefix+][+module+]:
    @@ -1277,7 +1279,7 @@ all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELS
            s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
            [+exports+] [+extra_exports+] \
            (cd [+subdir+]/[+module+] && \
    -         $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
    +         $(MAKE) $(BASE_FLAGS_TO_PASS) [+all--args+] [+stage1_args+] [+extra_make_flags+] \
                    $(TARGET-[+prefix+][+module+]))
     @endif [+prefix+][+module+]
     
    @@ -1312,7 +1314,7 @@ all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
                    CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
                    CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
                    LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
    -               [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
    +               [+all--args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
                    [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
                    TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
                    $(TARGET-stage[+id+]-[+prefix+][+module+])
    @@ -1327,7 +1329,7 @@ clean-stage[+id+]-[+prefix+][+module+]:
              $(MAKE) stage[+id+]-start; \
            fi; \
            cd [+subdir+]/[+module+] && \
    -       $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
    +       $(MAKE) [+all--args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
            [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
     @endif [+prefix+][+module+]-bootstrap