This contains the necessary sysroot flags if configured with
--with-build-sysroot, and matches the corresponding value for CC
in POSTSTAGE1_HOST_EXPORTS.

2020-03-25  Michael Forney  <mfor...@mforney.org>

        * Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Add XGCC_FLAGS_FOR_TARGET
        and TFLAGS to CXX.
        * Makefile.in: Regenerate.
---
I ran into this when building gcc with --enable-bootstrap and
--with-build-sysroot. Since the sysroot flag doesn't get passed to
xg++, the build fails at configure-stage2-gcc, since it can't find
the right headers:

    checking how to run the C++ preprocessor... /lib/cpp
    configure: error: in `/tmp/gcc/host-x86_64-linux-musl/gcc':
    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details
    make[2]: *** [Makefile:4434: configure-stage2-gcc] Error 1

 Makefile.in  | 4 ++--
 Makefile.tpl | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 86c0c6d5b2d..686983de233 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -248,8 +248,8 @@ POSTSTAGE1_CXX_EXPORT = \
          `if $(LEAN); then echo ' -isystem '; else echo ' -I'; 
fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
          `if $(LEAN); then echo ' -isystem '; else echo ' -I'; 
fi`$$s/libstdc++-v3/libsupc++ \
          -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
-         -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
-         export CXX; \
+         -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
+         $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
        CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
 @endif target-libstdc++-v3-bootstrap
 
diff --git a/Makefile.tpl b/Makefile.tpl
index efed1511750..b627069e8c8 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -251,8 +251,8 @@ POSTSTAGE1_CXX_EXPORT = \
          `if $(LEAN); then echo ' -isystem '; else echo ' -I'; 
fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
          `if $(LEAN); then echo ' -isystem '; else echo ' -I'; 
fi`$$s/libstdc++-v3/libsupc++ \
          -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
-         -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
-         export CXX; \
+         -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
+         $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
        CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
 @endif target-libstdc++-v3-bootstrap
 
-- 
2.26.0

Reply via email to