DescriptionChangeLog
* Makefile.in (gcc_gxx_include_dir_add_sysroot): New.
(PREPROCESSOR_DEFINES): Define GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT.
* cppdefault.c (cpp_include_defaults): replace hard coded "1" with
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT for "add_sysroot" field.
* configure.ac (AC_SUBST): Add gcc_gxx_include_dir_add_sysroot to
control whether sysroot should be prepended to gxx include dir.
* configure: Regenerate.
Hi, this is a follow up for issue "http://codereview.appspot.com/4641076".
The rationale for the patch copied from previous thread:
=======================================
The setup:
Configuring a toolchain targeting x86-64 GNU Linux (Ubuntu Lucid), as a
cross-compiler. Using a sysroot to provide the Lucid headers+libraries,
with the sysroot path being within the GCC install tree. Want to use the
Lucid system libstdc++ and headers, which means that I'm not
building/installing libstdc++-v3.
So, configuring with:
--with-sysroot="$SYSROOT"
--disable-libstdc++-v3 \
--with-gxx-include-dir="$SYSROOT/usr/include/c++/4.4" \
(among other options).
Hoping to support two usage models with this configuration, w.r.t. use of
the sysroot:
(1) somebody installs the sysroot in the normal location relative to the
GCC install, and relocates the whole bundle (sysroot+GCC). This works
great AFAICT, GCC finds its includes (including the C++ includes) thanks
to the add_standard_paths iprefix handling.
(2) somebody installs the sysroot in a non-standard location, and uses
--sysroot to try to access it. This works fine for the C headers, but
doesn't work.
For the C headers, add_standard_paths prepends the sysroot location to
the /usr/include path (since that's what's specified in cppdefault.c for
that path). It doesn't do the same for the C++ include path, though
(again, as specified in cppdefault.c).
add_standard_paths doesn't attempt to relocate built-in include paths that
start with the compiled-in sysroot location (e.g., the g++ include dir, in
this case). This isn't surprising really: normally you either prepend the
sysroot location or you don't (as specified by cppdefault.c); none of the
built-in paths normally *start* with the sysroot location and need to be
relocated. However, in this odd-ball case of trying to use the C++ headers
from the sysroot, one of the paths *does* need to be relocated in this way.
===========================
Chris(cgd@) provided a patch for the issue, but Joseph had a different opinion, my patch here is just coded as suggested.
Tested before/after on a x86_64-unknown-linux-gnu system, with
--enable-languages=all, RUNTESTFLAGS='--target_board=unix\{-m32,-m64\}'.
No changes in test results.
Patch Set 1 #Patch Set 2 : updated #Patch Set 3 : updated #Patch Set 4 : updated #
MessagesTotal messages: 6
|