The --sysroot
switch is useful when you don't want the headers/libraries in the standard paths affect your build.
--sysroot=dir
: Use dir as the logical root directory for headers and libraries. For example, if the compiler would normally search for headers in /usr/include and libraries in /usr/lib, it will instead search dir/usr/include and dir/usr/lib. [ref]
Can the same thing be accomplished through the use of environment variables, the gcc specs file, or any other methods that do not require command line switches?