Brian Dessent wrote:
NightStrike wrote:
Could someone explain to me in more detail than what is in the manual
what the differences are between the two options, with-sysroot and
with-build-sysroot?
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01579.html
It is always funny how even the experienced GCC developers are mixing
the 'STANDARD' and
'SYSTEM' names, taken from :
http://gcc.gnu.org/onlinedocs/gccint/Driver.html#Driver
the text :
----------------- clip --------------------------
— Macro: SYSTEM_INCLUDE_DIR
Define this macro as a C string constant if you wish to specify a
system-specific directory to search for header files before the standard
directory. SYSTEM_INCLUDE_DIR comes before STANDARD_INCLUDE_DIR in the
search order.
Cross compilers do not use this macro and do not search the directory
specified.
— Macro: STANDARD_INCLUDE_DIR
Define this macro as a C string constant if you wish to override the
standard choice of /usr/include as the default prefix to try when
searching for header files.
Cross compilers ignore this macro and do not search either /usr/include
or its replacement.
----------------- clip --------------------------
should be quite clear, GCC is prepared to use for TWO separate include
directories but that SYSTEM one
is usually unexisting, the first macro isn't defined in the $target
config headers. Meanwhile a cross GCC
ALWAYS has the equivalents of these two in use, the '$tooldir/include'
is the "standard" one and the
'$tooldir/sys-include' is the "system" one, the search order is just
what the previous text tells, the
system headers will be searched before the standard headers....
When always mixing these two and so thinking that the system headers in
a native GCC are in '/usr/include', and knowing that
the system headers in a cross GCC should go into the
'$tooldir/sys-include', the big mess is ready. People have used and will
use the '--with-headers=something' to copy for instance the generic
newlib headers into the '$tooldir/sys-include', or do this
manually. But when building newlib the final, target specific, headers
will go to the '$tooldir/include' and then be totally unseen
if there are headers with the same name in the '$tooldir/sys-include'
when using the compiler :(
So any advices to use the '--with-headers=' or to copy stuff into the
'$tooldir/sys-include' SHOULD also
include an advice to remove those copied headers if the final, "right",
headers really are in the documented
equivalent to the native '/usr/include' (or that imagined one in a
newlib-based pure crosscompiler)!
Ok, I'm not sure at all that all those cross GCC builders would grok
that "imaginary target system" in those
embedded target cases, to see the "target system" to have the headers in
that '/usr/include', the target libs
in '/usr/lib' etc. And then use a separate '$sysroot' to keep this
"copied target stuff"... Mentioning these
'--with-*sysroot' options in the context of newlib based targets is
really odd... Traditionally those GCCs
for embedded (usually newlib-based) targets have been the models of
"pure" GCCs, they have only ONE
possible incarnation, a "GCC", which then follows the portable "cross
GCC" install scheme...
When one for instance switches from one Linux distro to another, all the
GCCs made that far will follow
as long as there is any backwards binary compatability... Maybe a really
wacky idea in this "use once,
throw away" world (e.g. current Windozes which cannot be taken with
"like a hard disk" when updating
the PC and putting the old PC for bare Linux-use!), but some then really
believe that "more recycling
would save the world" :)