Subject: bug#49935: closed (Re: bug#49935: gcc-4.8 fails to build with recent GCC versions)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 24 Apr 2025 14:09:03 +0000

Your bug report

#49935: gcc-4.8 fails to build with recent GCC versions

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
49935: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49935
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#49935: gcc-4.8 fails to build with recent GCC versions
From: Greg Hogan <[email-masked]>
To: [email-masked], [email-masked]
Date: Thu, 24 Apr 2025 10:07:44 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

On Fri, Jan 19, 2024 at 12:19 PM Thomas Schwinge <[email-masked]> wrote:
>
> On 2021-08-07T20:07:32-0300, Thiago Jung Bauermann via Bug reports for GNU Guix <[email-masked]> wrote:
> > In file included from /tmp/guix-build-gcc-4.8.5.drv-0/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/cstdlib:72:0,
> >                  from ../../../../gcc-4.8.5/libstdc++-v3/libsupc++/del_op.cc:38:
> > /gnu/store/358n1m2c8fbn6nr1mib4racjh7wfqfmy-gcc-10.3.0/include/c++/stdlib.h:38:12: error: ‘std::abort’ has not been declared
> >  using std::abort;
> >             ^
> > /gnu/store/358n1m2c8fbn6nr1mib4racjh7wfqfmy-gcc-10.3.0/include/c++/stdlib.h:39:12: error: ‘std::atexit’ has not been declared
> >  using std::atexit;
> >             ^
> > [...]
>
> This looks similar to <https://issues.guix.gnu.org/41209>
> "AVR toolchain fails to build", fixed by
> commit fd96ae4a709c5509f2d78af3968d64fe805ad1ef
> "gnu: avr-gcc: Fix conflicting GCC headers", or
> <https://issues.guix.gnu.org/41210>
> "gcc-cross-sans-libc-arm-none-eabi-4.9.4-1.227977 fails to build", fixed
> by commit 7f6d3f395023ff430cf8b7a981d4780698e9d132
> "gnu: gcc-arm-none-eabi: Fix conflicting GCC headers".

Closing both reports as gcc-4.8.5 is currently building and substitutable:
 https://ci.guix.gnu.org/build/3409224/details

Subject: gcc-4.8 fails to build with recent GCC versions
From: Thiago Jung Bauermann <[email-masked]>
To: Bug Guix <[email-masked]>
Date: Sat, 07 Aug 2021 20:07:32 -0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

According to the CI results, gcc-4.8 hasn’t built successfuly in a while:

https://ci.guix.gnu.org/search?query=gcc-4.8

I was able to fix the current build failure:

--8<---------------cut here---------------start------------->8---
In file included from ../../gcc-4.8.5/gcc/cp/except.c:1008:0:
cfns.gperf: In function ‘const char* libc_name_p(const char*, unsigned int)’:
cfns.gperf:101:1: error: ‘const char* libc_name_p(const char*, unsigned int)’ redeclared inline with ‘gnu_inline’ attribute
cfns.gperf:26:14: note: ‘const char* libc_name_p(const char*, unsigned int)’ previously declared here
--8<---------------cut here---------------end--------------->8---

by backporting a patch from GCC 4.9 (which I will send in the next email),
but then I hit another failure:

--8<---------------cut here---------------start------------->8---
In file included from /tmp/guix-build-gcc-4.8.5.drv-0/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/cstdlib:72:0,
                 from ../../../../gcc-4.8.5/libstdc++-v3/libsupc++/del_op.cc:38:
/gnu/store/358n1m2c8fbn6nr1mib4racjh7wfqfmy-gcc-10.3.0/include/c++/stdlib.h:38:12: error: ‘std::abort’ has not been declared
 using std::abort;
            ^
/gnu/store/358n1m2c8fbn6nr1mib4racjh7wfqfmy-gcc-10.3.0/include/c++/stdlib.h:39:12: error: ‘std::atexit’ has not been declared
 using std::atexit;
            ^
/gnu/store/358n1m2c8fbn6nr1mib4racjh7wfqfmy-gcc-10.3.0/include/c++/stdlib.h:40:12: error: ‘std::exit’ has not been declared
 using std::exit;
            ^
/gnu/store/358n1m2c8fbn6nr1mib4racjh7wfqfmy-gcc-10.3.0/include/c++/stdlib.h:51:12: error: ‘std::div_t’ has not been declared
 using std::div_t;
            ^
/gnu/store/358n1m2c8fbn6nr1mib4racjh7wfqfmy-gcc-10.3.0/include/c++/stdlib.h:52:12: error: ‘std::ldiv_t’ has not been declared
 using std::ldiv_t;
            ^
    ⋮
--8<---------------cut here---------------end--------------->8---

and so on, for several `std::` functions. Unlike the other old GCC build
failures I’ve investigated recently, I couldn’t find anyone else hitting
this specific problem. So we would have to create our own patch to fix it.

This message from Jakub Jelinek about a similar error in some unspecified
package:

https://lists.fedoraproject.org/archives/list/[email-masked]/message/Q2U4JFUB5RL7DU2XJZ4BDTRE4PVULOMG/

makes me think that there’s something in GCC 4.8’s libstdc++ (probably
in libsupc++) doing something wrong with <stdlib.h> which trips GCC 6
and later.

However, I don’t think it’s worth making GCC 4.8 build again. It’s not
supported upstream anymore and if it’s needed in some bootstrap path,
it’s better to move it to ‘(gnu packages commencement)’ instead. In that
case, instead of fixing this build issue it’s likely better to just build
it with a GCC older than version 6.

Is it needed for bootstrap though? The definition of ‘%bootstrap-gcc’
suggests that it’s needed at least for armhf-linux but since aarch64-linux,
powerpc64le-linux and even i586-hurd use GCC 5.5, I suspect it would also
work for armhf-linux as well.

Therefore, my suggestion is to simply remove gcc-4.8.

-- 
Thanks,
Thiago