HI, Thank you for your suggestions. I've tried the CFLAGS with fixed paths, and am still not successful. I think I am trying to do what you describe at the end - I want to produce a GCC that only depends on artifacts found in my /bootstrap tree. If I move this whole tree to a new environment, I'd like to still be able to use this compiler to build arbitrary software. > you are not building a GCC which is meant to run in a new OS tree (chroot or container, or even reboot into a new OS tree), it's likely you shouldn't use sysroot at all. On Tue, Mar 15, 2022 at 3:19 AM Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> wrote: > On Mon, 2022-03-14 at 18:43 -0400, Benjamin Lovy wrote: > > /* snip */ > > > Now, I would like to build a fresh GCC using the previously build GCC, > > this > > glib, and the GMP/MPC/MPFR libraries I just built: > > > > /build/gcc-11.2.0/configure \ > > CFLAGS="-Wl,-dynamic-linker=/lib/ld-linux-x86-64.so.2 -Wl,-rpath,/lib > > -I/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include -I/usr/include > > -I/usr/include/linux -I/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include- > > fixed > > -B/bin" \ > > I think these FLAGS are mistaken. --sysroot won't expand -I/usr/include > to search $SYSROOT/usr/include for example. > > And, Without "-O2" your GCC will be built without optimization, which > will make a stupidly slow compiler. > > > --prefix=/bootstrap/gcc \ > > --host=x86_64-pc-linux-gnu \ > > --with-sysroot=/bootstrap \ > > You need --with-build-sysroot instead of --with-sysroot. Read > https://gcc.gnu.org/install/configure.html for their difference. > > Please note --sysroot is mostly for cross-compilation. If you are not > building a GCC which is meant to run in a new OS tree (chroot or > container, or even reboot into a new OS tree), it's likely you shouldn't > use sysroot at all. > -- > Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> > School of Aerospace Science and Technology, Xidian University >