On Tue, 11 Jan 2022 at 06:54, Xi Ruoyao wrote: > > On Tue, 2022-01-11 at 03:44 +0000, Thomas Sobczynski wrote: > > Update: I kept peering at the configure scripts and their embedded > > comments, and concluded that it's at least worth trying to add "-- > > with-newlib" to the configure script parameters. That may not be the > > right move, but it did get me further into the build process. However, > > although its configure script finished, the GCC build seems unable to > > compile libstdc++ (tail end of output below). > > > > Am I barking up the wrong tree with "--with-newlib"? > > I think --with-newlib is needed, as it's the de-facto C library on bare > metal ARM. But you need to install newlib for the target before > building libstdc++, because libstdc++ needs a C library. Strictly speaking it doesn't need one, but you have to use --disable-hosted-libstdcxx --without-headers --with-newlib to tell it you have no C library. On the master branch you no longer need the --with-newlib for that case (PR 103866). Building trunk, or backporting the fix for that bug to gcc-11, might make life easier. > > And your configuration may trigger > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017, which is fixed in > GCC 11 branch recently. You may need to "git pull" your GCC 11 branch > to overcome it. Yes, building a canadian cross for bare metal, involving Windows, is like falling out of the ugly tree and hitting every branch on the way down. > Maybe you can add --disable-libstdcxx and build a GCC without libstdc++, > reboot into Windows, and then compile newlib & libstdc++ for target with > the toolchain just built. > > However, honestly I don't do any serious development on Windows... > > Does it make sense that the build is supplying include search > > directories from the GCC v11 build tree (compiler being compiled) to > > the native cross compiler which is GCC v9.x? I already misunderstood > > the build/host/target config earlier. Is it perhaps not_a_ GCC cross > > toolchain that I need, but perhaps I need to build _the_ compiler > > (v11) and then turn around and use it to build for the non-native > > Host? > > "__has_builtin" is introduced in GCC 10, so GCC 9 can't recognize it. > IIRC libstdc++ from a specific GCC version is only expected to be built > with GCC with the same version. Correct.