On Tue, Sep 28, 2021 at 09:09:43AM -0700, Oleg Smolsky via Gcc-help wrote: > On Sat, Sep 25, 2021 at 3:18 AM Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> wrote: > > If you want a compiler running in sysroot (after reboot/chroot into it), > > cross-compile it with a cross compiler (using --host=x86_64-sysroot- > > linux-gnu). > > > > You may find some way to pretend the executables for sysroot "runnable > > on the host", but it's not the expected usage of GCC building system and > > likely to be broken if something in the building system changes. > > I am trying to get both: such executables run on the host system, yet all > run-time dependencies are located within the "sysroot". I vaguely remember > someone calling such a x86-to-x86 cross-compiler a "Canadian cross"... The > idea here is to enforce a tight, fully-encapsulated build environment for > the host and then ship it all into the production. This combo runs on any > Linux distro... "Cross compiler" means that the host is not the same as the build. A Canadian cross has the build system a different system as well. build = host = target is the normal "native" case. build = host != target is the normal "cross" case. build != host = target is building a native compiler on a different system. This is not often done anymore. build = target != host is sometimes called "cross-back". This is the rarest kind perhaps. It is sometimes done as part of a new port, and in that case you have various other of the above types as well, and hopefully you fully know ewhat you are doing. It isn't useful for most users. If host is linux and target is mingw, then this always is a cross, no matter if the CPU architecture on both is the same. The full triple matters. Segher