I am compiling gcc and reading manual from https://gcc.gnu.org/install/configure.html
--with-local-prefix=dirname Specify the installation directory for local include files. The default is /usr/local. Specify this option if
you want the compiler to search directory dirname/include for locally
installed header files instead of /usr/local/include.
--with-sysroot=dir Tells GCC to consider dir as the root of a tree that contains (a subset of) the root filesystem of the target
operating system. Target system headers, libraries and run-time object
files will be searched for in there. More specifically, this acts as
if --sysroot=dir was added to the default options of the built
If you specify the --with-native-system-header-dir=dirname option then
the compiler will search that directory within dirname for native
system headers rather than the default /usr/include.
yum install gcc gcc-c++
/home/myuser/gcc-5.4.0/configure --prefix=/home/gcc540 --disable-multilib --with-system-zlib --enable-languages=c,c++ --with-local-prefix=/home/myotherbin/local --with-gxx-include-dir=/home/gcc540/header
--with-sysroot option is only useful when you build a cross-compiler : the resulting, built gcc will know where to find the target platform's headers and libraries (i.e. it will have a default value for the --sysroot option). The
--with-native-system-header-dir is a refinement of the
--with-sysroot option and allows to specify a directory relative to the one specified for
--with-sysroot where native platform headers will be found. GCC distinguishes its own headers (the ones it copies as part of
make install) from the "native" headers that are provided by the operating system itself and were already there regardless of the GCC install.