https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91879
--- Comment #13 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Wed, 25 Sep 2019, stsp at users dot sourceforge.net wrote: > Unfortunately I wasn't able to fully understand the > idea you explain. You mention "sysroot" and "non-sysroot" > builds, and you suggest to use --with-build-sysroot= > together with --with-sysroot= (without providing an example > of how to set --with-build-sysroot=, so I assume it should > be equal to $DESTDIR). May I assume that in the "sysroot" No, it should be $DESTDIR/$prefix/$target (and then you need a symlink usr -> . under that directory if GCC thinks /usr/include is the system include directory for that target). > build all the -isystem pathes will be changed the way the > sysroot prefix is replaced with build-sysroot prefix during > libs build? The relevant paths will be the ones in SYSROOT_CFLAGS_FOR_TARGET (--sysroot option, not -isystem). > -build_tooldir=${tooldir} > +build_tooldir=${build_sysroot_path}${tooldir} > > # Create a .gdbinit file which runs the one in srcdir > # and tells GDB to look there for source files. > ------ > > What do you think guys? Does it break something? > It definitely works for me. That's not a correct change. tooldir is a *host* path, not a target one, and the build sysroot can only correctly be prepended to *target* paths.