This probably doesn't matter to very many people, and it may not deserve a separate PR, but I thought I should mention the following.... Since upgrading a build machine from 8.99.32 to 9.99.64 (thus upgrading its compiler to GCC-8.4.0) my builds of the netbsd-5 branch have failed as shown below. Basically it looks like newer GCCs can no longer compile older GCCs, at least for the NetBSD variant(s). On the other hand, if anyone does need to rebuild an older source tree for whatever reason, this kind of error will cause a headache. It's hard to reproduce a build if one can't even build the original toolchain any more! One option might be to install an older release to do the build, or perhaps one can just install an older compiler and use that. However perhaps there's a better option that can be used to allow a new compiler to build the old toolchain, but without requiring changes to the old toolchain. If anyone can think of a way, please let me know! On a possibly related note, how is this dealt with in pkgsrc for building older GCC releases with newer releases? It looked at first like there is in fact one patch in pkgsrc that would fix this problem, though it seems from its commit comment that it was needed from a time far longer ago to build GCC-4.4 with Clang, and it doesn't actually fix the bug for building with GCC-8.4.0: lang/gcc44/patches/patch-gcc_toplev.h This seems to be the proper fix for building old GCC with newer GCC (possibly in combination with the patch from pkgsrc? I didn't try without): --- toplev.c.~1.1.1.2.~ 2006-10-21 15:31:50.000000000 -0700 +++ toplev.c 2021-02-24 10:11:05.005538991 -0800 @@ -517,6 +517,7 @@ return atoi (p); } +#if GCC_VERSION < 3004 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X. If X is 0, return -1. */ @@ -566,6 +567,7 @@ return floor_log2 (x); #endif } +#endif /* GCC_VERSION < 3004 */ /* Handler for fatal signals, such as SIGSEGV. These are transformed into ICE messages, which is much more user friendly. In case the nbgmake[1]: Entering directory `/build/woods/b2/netbsd-5-amd64-i386-ppro-obj/work/woods/m-NetBSD-5/tools/gcc/build/gcc' cc -pipe -O2 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -g -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wmissing-format-attribute -DHAVE_CONFIG_H -I. -I. -I/work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc -I/work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/. -I/work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/../include -I/work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/../libcpp/include -DNETBSD_TOOLS \ -DTARGET_NAME=\"i386--netbsdelf\" \ -c /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.c -o toplev.o [[ .... ]] /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.c: At top level: /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.c:524:1: error: redefinition of 'floor_log2' floor_log2 (unsigned HOST_WIDE_INT x) ^~~~~~~~~~ In file included from /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.c:59: /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.h:175:1: note: previous definition of 'floor_log2' was here floor_log2 (unsigned HOST_WIDE_INT x) ^~~~~~~~~~ /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.c:559:1: error: redefinition of 'exact_log2' exact_log2 (unsigned HOST_WIDE_INT x) ^~~~~~~~~~ In file included from /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.c:59: /work/woods/m-NetBSD-5/tools/gcc/../../gnu/dist/gcc4/gcc/toplev.h:181:1: note: previous definition of 'exact_log2' was here exact_log2 (unsigned HOST_WIDE_INT x) ^~~~~~~~~~ nbgmake[1]: *** [toplev.o] Error 1 nbgmake[1]: Leaving directory `/build/woods/b2/netbsd-5-amd64-i386-ppro-obj/work/woods/m-NetBSD-5/tools/gcc/build/gcc' nbgmake: *** [all-gcc] Error 2 *** Failed target: .build_done *** Failed command: (cd build && /usr/bin/env -i gcc_cv_libc_provides_ssp=yes AR=ar AWK=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/nbawk CC=cc CFLAGS=-pipe\ -O2\ -W\ -Wall\ -Wstrict-prototypes\ -Wmissing-prototypes\ -Wpointer-arith\ -Wno-uninitialized\ -g CPPFLAGS= CXX=c++ CXXFLAGS=-pipe\ -O2\ -W\ -Wall\ -Wstrict-prototypes\ -Wmissing-prototypes\ -Wpointer-arith\ -Wno-uninitialized INSTALL=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/i386--netbsdelf-install\ -c\ -p\ -r LDFLAGS=-g\ -static LDSTATIC=-static LEX=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/nblex MAKE=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/nbgmake PATH="/build/woods/b2/netbsd-5-amd64-i386-tools/bin:$PATH" RANLIB=ranlib YACC=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/nbyacc MACHINE= MAKEINFO=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/nbmakeinfo LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= EXTRA_PARTS= CPPFLAGS=-DNETBSD_TOOLS AR=ar RANLIB=ranlib BISON=true DESTDIR= INSTALL=/build/woods/b2/netbs d-5-amd64-i386-tools/bin/i386--netbsdelf-install\ -c\ -p\ -r /build/woods/b2/netbsd-5-amd64-i386-tools/bin/nbgmake -e MACHINE= MAKEINFO=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/nbmakeinfo LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= EXTRA_PARTS= CPPFLAGS=-DNETBSD_TOOLS AR=ar RANLIB=ranlib BISON=true DESTDIR= INSTALL=/build/woods/b2/netbsd-5-amd64-i386-tools/bin/i386--netbsdelf-install\ -c\ -p\ -r all-gcc) *** Error code 2 Stop. nbmake: stopped in /work/woods/m-NetBSD-5/tools/gcc Note there are also lots of other new warnings from a newer compiler building the older toolchain! -- Greg A. Woods <gwoods%acm.org@localhost> Kelowna, BC +1 250 762-7675 RoboHack <woods%robohack.ca@localhost> Planix, Inc. <woods%planix.com@localhost> Avoncote Farms <woods%avoncote.ca@localhost>
Attachment:
pgpBhvbcg1o9b.pgp
Description: OpenPGP Digital Signature