Instead of using pkgsrc, why don't you use NetBSD build.sh to build the cross-compiling tools? NetBSD 10.x comes with GCC 12 if I'm not mistaken.
On Fri, Aug 08, 2025 at 12:59:05PM -0400, Alexander Jacocks wrote: > Folks, > > I have a Pentium II 350 machine that I run NetBSD 10.1 on. Obviously, it can > build for itself, especially since it has a silly 1GB of RAM, but it?s > extremely slow, as expected, when building. > > So, I use an AMD64 VM , also running NetBSD 10.1, to do the building. I?m > having issues cross-compiling GCC12, and wanted to see if anyone else has > seen the same issue. > > I?m using current stable pkgsrc. > > The relevant section of my my.conf looks like this: > > # Cross compiling > #USE_CROSS_COMPILE=yes > CROSS_MACHINE_ARCH=i386 > TOOLDIR=/home/ajacocks/src/netbsd/10.1/obj.i386/tooldir.NetBSD-10.1-amd64 > CROSS_DESTDIR=/home/ajacocks/src/netbsd/10.1/obj.i386/destdir.i386 > CROSS_OPSYS=NetBSD > CROSS_LOWER_OPSYS=netbsd > CROSS_OS_VERSION=10.1 > CROSS_OPSYS_VERSION=101000 > CROSS_LOWER_OPSYS_VERSUFFIX= > CROSS_LOWER_OS_VARIANT= > CROSS_LOWER_VARIANT_VERSION= > CROSS_LOWER_VENDOR= > CROSS_OBJECT_FMT=ELF > > I launch the compile with: > > netbsd# cd /usr/pkgsrc/lang/gcc12 > netbsd# USE_CROSS_COMPILE=yes bmake package > => Bootstrap dependency digest>=20211023: found digest-20220214 > => Fetching gcc-12.4.0.tar.xz > => Fetching isl-0.16.1.tar.bz2 > => Fetching in-place gmp > => Bootstrap dependency digest>=20211023: found digest-20220214 > => Fetching gmp-6.3.0.tar.bz2 > => Checksum BLAKE2s OK for gmp-6.3.0.tar.bz2 > => Checksum SHA512 OK for gmp-6.3.0.tar.bz2 > => Fetching in-place > ? > > The error comes up here: > > gmake[2]: Nothing to be done for 'all'. > gmake[2]: Leaving directory > '/usr/pkgsrc/lang/gcc12/work.NetBSD-10.1-i386/build/c++tools' > gmake[3]: Entering directory > '/usr/pkgsrc/lang/gcc12/work.NetBSD-10.1-i386/build/libcc1' > gmake[2]: Entering directory > '/usr/pkgsrc/lang/gcc12/work.NetBSD-10.1-i386/build/i486--netbsdelf/libgcc' > gmake[3]: Leaving directory > '/usr/pkgsrc/lang/gcc12/work.NetBSD-10.1-i386/build/libcc1' > gmake[2]: Leaving directory > '/usr/pkgsrc/lang/gcc12/work.NetBSD-10.1-i386/build/libcc1' > # If this is the top-level multilib, build all the other > # multilibs. > dest=../.././gcc/include/tmp$$-unwind.h; \ > cp unwind.h $dest; \ > chmod a+r $dest; \ > sh ../../../gcc-12.4.0/libgcc/../move-if-change $dest > ../.././gcc/include/unwind.h > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _divsc3.o -MT _divsc3.o -MD -MP -MF _divsc3.dep -DL_divsc3 > -c ../../../gcc-12.4.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _divdc3.o -MT _divdc3.o -MD -MP -MF _divdc3.dep -DL_divdc3 > -c ../../../gcc-12.4.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _divxc3.o -MT _divxc3.o -MD -MP -MF _divxc3.dep -DL_divxc3 > -c ../../../gcc-12.4.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _divtc3.o -MT _divtc3.o -MD -MP -MF _divtc3.dep -DL_divtc3 > -c ../../../gcc-12.4.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-stgmake[3]: Entering directory > '/usr/pkgsrc/lang/gcc12/work.NetBSD-10.1-i386/build/i486--netbsdelf/libgcc' > rings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes > -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 > -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../.././gcc > -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _fixunssfsi.o -MT _fixunssfsi.o -MD -MP -MF > _fixunssfsi.dep -DL_fixunssfsi -c ../../../gcc-12.4.0/libgcc/libgcc2.c > -fvisibility=hidden -DHIDE_EXPORTS > rings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes > -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 > -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../.././gcc > -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _fixunssfsi.o -MT _fixunssfsi.o -MD -MP -MF > _fixunssfsi.dep -DL_fixunssfsi -c ../../../gcc-12.4.0/libgcc/libgcc2.c > -fvisibility=hidden -DHIDE_EXPORTS > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _fixunsdfsi.o -MT _fixunsdfsi.o -MD -MP -MF > _fixunsdfsi.dep -DL_fixunsdfsi -c ../../../gcc-12.4.0/libgcc/libgcc2.c > -fvisibility=hidden -DHIDE_EXPORTS > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _fixunsxfsi.o -MT _fixunsxfsi.o -MD -MP -MF > _fixunsxfsi.dep -DL_fixunsxfsi -c ../../../gcc-12.4.0/libgcc/libgcc2.c > -fvisibility=hidden -DHIDE_EXPORTS > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _fixsfdi.o -MT _fixsfdi.o -MD -MP -MF _fixsfdi.dep > -DL_fixsfdi -c ../../../gcc-12.4.0/libgcc/libgcc2.c -fvisibility=hidden > -DHIDE_EXPORTS > gmake[3]: Leaving directory > '/usr/pkgsrc/lang/gcc12/work.NetBSD-10.1-i386/build/i486--netbsdelf/libgcc' > cc -g -O2 -I/usr/include -O2 -g -O2 -I/usr/include -DIN_GCC -W -Wall > -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes > -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g > -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. > -I../.././gcc -I../../../gcc-12.4.0/libgcc -I../../../gcc-12.4.0/libgcc/. > -I../../../gcc-12.4.0/libgcc/../gcc -I../../../gcc-12.4.0/libgcc/../include > -DHAVE_CC_TLS -o _fixdfdi.o -MT _fixdfdi.o -MD -MP -MF _fixdfdi.dep > -DL_fixdfdi -c ../../../gcc-12.4.0/libgcc/libgcc2.c -fvisibility=hidden > -DHIDE_EXPORTS > ../../../gcc-12.4.0/libgcc/libgcc2.c: In function '__divsc3': > ../../../gcc-12.4.0/libgcc/libgcc2.c:1874:16: error: '__LIBGCC_SF_MAX__' > undeclared (first use in this function) > 1874 | # define RBIG (__LIBGCC_SF_MAX__ / 2) > | ^~~~~~~~~~~~~~~~~ > ../../../gcc-12.4.0/libgcc/libgcc2.c:2063:23: note: in expansion of macro > 'RBIG' > 2063 | if (FABS (d) >= RBIG) > | ^~~~ > ../../../gcc-12.4.0/libgcc/libgcc2.c:1874:16: note: each undeclared > identifier is reported only once for each function it appears in > 1874 | # define RBIG (__LIBGCC_SF_MAX__ / 2) > | ^~~~~~~~~~~~~~~~~ > ../../../gcc-12.4.0/libgcc/libgcc2.c:2063:23: note: in expansion of macro > 'RBIG' > 2063 | if (FABS (d) >= RBIG) > | ^~~~ > ../../../gcc-12.4.0/libgcc/libgcc2.c:1876:17: error: '__LIBGCC_SF_EPSILON__' > undeclared (first use in this function) > 1876 | # define RMIN2 (__LIBGCC_SF_EPSILON__) > | ^~~~~~~~~~~~~~~~~~~~~ > ../../../gcc-12.4.0/libgcc/libgcc2.c:2073:22: note: in expansion of macro > 'RMIN2' > 2073 | if (FABS (d) < RMIN2) > | ^~~~~ > > Has anyone had success cross-compiling gcc12 with current stable pkgsrc? > > Thanks! > - Alex -- Thierry Laronde <tlaronde +AT+ kergis +dot+ com> http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C