Hi,

I saw incorrect gcc/configure results when building a native compiler
with a cross compiler. I think I understand what is going wrong there
but looking for your opinion on my thoughts:

Let's get through the thing with an example.

Assume:
$build == i686-pc-linux-gnu
$host == $target == arm-linux-gnu

Let's further assume my build system has sys/sdt.h, while my target does not.

In this scenario gcc/configure incorrectly concludes that my target
has sys/sdt.h.

This seems to happen like this:

Since $host == $target and there is no $TARGET_SYSTEM_ROOT set (The
compiler I am building that way will operate as a native compiler.)
configure concludes target_header_dir=${native_system_header_dir}

This conclusion seems wrong in case $build != $target and because of
that all tests for target headers are done on the build system instead
of the sys-root for the target.

Did I miss something that I should have set for this specific scenario
or do you agree that I should patch the configure to consider in case
of $host == $target the special case of $build != $target, in which
case I should figure out the location of the build system compiler's
sys-root and set target_header_dir to that one?

That means something like:

if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
  [... some other code not of interest here ...]
elif test x$build != x$target; then
  target_header_dir=${sysroot_of_build_cc_header_dir}
else
  target_header_dir=${native_system_header_dir}
fi

assuming that I can figure out sysroot_of_build_cc_header_dir in some way.

Robert

Reply via email to