Hi All:
      About "--with-sysroot" option, I got some understanding
following but not sure about it.
All words are based on gcc-3.4.2.
      For a native gcc, There are three important macro
LOCAL_INCLUDE_DIR, SYSTEM_INCLUDE_DIR
and STANDARD_INCLUDE_DIR. Gcc built will search headers in directories
defined by these macro.
      For a "build=host != target" cross gcc, there are two cases:
      Firstly, If configured without option "--with-sysroot", the gcc
built will search headers in directory defined
by macro CROSS_INCLUDE_DIR. Everything is ok if CROSS_INCLUDE_DIR is
right and it is makefile's
responsibility to define and pass this macro to gcc(such cppdefault.c etc.).
      Secondly, if gcc is configured with option "--with-sysroot=XXX",
it will search header files in directories
defined by macro LOCAL_INCLUDE_DIR, SYSTEM_INCLUDE_DIR and
STANDARD_INCLUDE_DIR, just
like native compiler do, but start from directory defined by macro
TARGET_SYSTEM_ROOT.
      Though both methods works for cross compiler, the second one
makes it possible to near the gap
between native and cross compiler. I think that is why gcc developers
added "with-sysroot" configure option.
Of course they went even further by providing "sysroot" command option.

      All of those are my comprehension, and I am not sure about it. I
will be very glad if anyone correct it if
I am wrong and any message will be appreciated.
Thanks.

Reply via email to