Hi, If the PATH contains the current working directory (yes a bad idea but it could happen with our users), the build fails because it finds the newly created g++ which might not find the correct cc1plus. See the thread starting at http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01032.html .
This fixes the problem by changing the name of the built g++ to xg++ just like how gcc is handled with xgcc. I had to change the few places where g++ is used. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions and made sure the installed binary was called g++. Thanks, Andrew Pinski ChangeLog: * configure.ac (CXX_FOR_TARGET): Change over to use xg++. * configure: Regenerate. * Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Change over to use xg++. * Makefile.in: Regenerate. gcc/testsuite/ChangeLog: * lib/g++.exp (g++_init): Search for xg++ instead of g++ in the build directories. * lib/obj-c++.exp (obj-c++_init): Likewise. gcc/cp/ChangeLog: * Make-lang.in (g++$(exeext)): Rename to (xg++$(exeext)): This. (g++-cross$(exeext)): Use xg++$(exeext) instead of g++$(exeext). (c++.start.encap): Likewise. (c++.install-common): Likewise. gcc/ChangeLog: * Makefile.in (${QMTEST_DIR}/context): Use xg++ instead of g++. libstdc++-v3/ChangeLog: * scripts/testsuite_flags.in (--build-cxx): Use xg++ instead of g++. * testsuite/lib/libstdc++.exp (libstdc++_init): Likewise.
Index: Makefile.in =================================================================== --- Makefile.in (revision 193542) +++ Makefile.in (working copy) @@ -235,7 +235,7 @@ POSTSTAGE1_CXX_EXPORT = \ @if target-libstdc++-v3-bootstrap # Override the above if we're bootstrapping C++. POSTSTAGE1_CXX_EXPORT = \ - CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/g++$(exeext) \ + CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \ -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ Index: libstdc++-v3/scripts/testsuite_flags.in =================================================================== --- libstdc++-v3/scripts/testsuite_flags.in (revision 193542) +++ libstdc++-v3/scripts/testsuite_flags.in (working copy) @@ -45,7 +45,7 @@ case ${query} in ;; --build-cxx) CXX_build="@CXX@" - CXX=`echo "$CXX_build" | sed 's,gcc/xgcc ,gcc/g++ ,'` + CXX=`echo "$CXX_build" | sed 's,gcc/xgcc ,gcc/xg++ ,'` echo ${CXX} ;; --build-cc) Index: libstdc++-v3/testsuite/lib/libstdc++.exp =================================================================== --- libstdc++-v3/testsuite/lib/libstdc++.exp (revision 193542) +++ libstdc++-v3/testsuite/lib/libstdc++.exp (working copy) @@ -181,7 +181,7 @@ proc libstdc++_init { testfile } { # Compute what needs to be added to the existing LD_LIBRARY_PATH. if {$gccdir != ""} { - set compiler ${gccdir}/g++ + set compiler ${gccdir}/xg++ set ld_library_path ${ld_library_path_tmp} append ld_library_path ":${blddir}/src/.libs" Index: configure.ac =================================================================== --- configure.ac (revision 193542) +++ configure.ac (working copy) @@ -3129,7 +3129,7 @@ GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [ GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX, - [gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs], + [gcc/xg++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs], c++) GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX, [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs], Index: configure =================================================================== --- configure (revision 193542) +++ configure (working copy) @@ -13628,7 +13628,7 @@ else esac if test $ok = yes; then # An in-tree tool is available and we can use it - CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' + CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xg++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' { $as_echo "$as_me:${as_lineno-$LINENO}: result: just compiled" >&5 $as_echo "just compiled" >&6; } elif expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then Index: gcc/testsuite/lib/g++.exp =================================================================== --- gcc/testsuite/lib/g++.exp (revision 193542) +++ gcc/testsuite/lib/g++.exp (working copy) @@ -210,7 +210,7 @@ proc g++_init { args } { if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } { set GXX_UNDER_TEST [transform c++] } else { - set GXX_UNDER_TEST [findfile $base_dir/../../g++ "$base_dir/../../g++ -B$base_dir/../../" [findfile $base_dir/g++ "$base_dir/g++ -B$base_dir/" [transform c++]]] + set GXX_UNDER_TEST [findfile $base_dir/../../xg++ "$base_dir/../../xg++ -B$base_dir/../../" [findfile $base_dir/xg++ "$base_dir/xg++ -B$base_dir/" [transform c++]]] } } } Index: gcc/testsuite/lib/obj-c++.exp =================================================================== --- gcc/testsuite/lib/obj-c++.exp (revision 193542) +++ gcc/testsuite/lib/obj-c++.exp (working copy) @@ -221,7 +221,7 @@ proc obj-c++_init { args } { if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } { set OBJCXX_UNDER_TEST [transform c++] } else { - set OBJCXX_UNDER_TEST [findfile $base_dir/../../g++ "$base_dir/../../g++ -B$base_dir/../../" [findfile $base_dir/g++ "$base_dir/g++ -B$base_dir/" [transform c++]]] + set OBJCXX_UNDER_TEST [findfile $base_dir/../../xg++ "$base_dir/../../xg++ -B$base_dir/../../" [findfile $base_dir/xg++ "$base_dir/xg++ -B$base_dir/" [transform c++]]] } } } Index: gcc/cp/Make-lang.in =================================================================== --- gcc/cp/Make-lang.in (revision 193542) +++ gcc/cp/Make-lang.in (working copy) @@ -61,15 +61,15 @@ g++spec.o: $(srcdir)/cp/g++spec.c $(SYST # Create the compiler driver for g++. GXX_OBJS = $(GCC_OBJS) g++spec.o -g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) +xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ $(EXTRA_GCC_LIBS) $(LIBS) # Create a version of the g++ driver which calls the cross-compiler. -g++-cross$(exeext): g++$(exeext) +g++-cross$(exeext): xg++$(exeext) -rm -f g++-cross$(exeext) - cp g++$(exeext) g++-cross$(exeext) + cp xg++$(exeext) g++-cross$(exeext) # The compiler itself. # Shared with C front end: @@ -124,7 +124,7 @@ endif # Build hooks: c++.all.cross: g++-cross$(exeext) -c++.start.encap: g++$(exeext) +c++.start.encap: xg++$(exeext) c++.rest.encap: c++.info: c++.install-info: @@ -172,7 +172,7 @@ check_g++_parallelize = old-deja.exp dg. # and also as either g++ (if native) or $(tooldir)/bin/g++. c++.install-common: installdirs -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) - -$(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) + -$(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) -rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) -( cd $(DESTDIR)$(bindir) && \ Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 193542) +++ gcc/Makefile.in (working copy) @@ -5175,7 +5175,7 @@ ${QMTEST_DIR}/context: stamp-qmtest echo "CompilerTable.c_path=${objdir}/xgcc" >> $@ echo "CompilerTable.c_options=-B${objdir}/" >> $@ echo "CompilerTable.cplusplus_kind=GCC" >> $@ - echo "CompilerTable.cplusplus_path=${objdir}/g++" >> $@ + echo "CompilerTable.cplusplus_path=${objdir}/xg++" >> $@ echo "CompilerTable.cplusplus_options=-B${objdir}/" >> $@ echo "DejaGNUTest.target=${target_noncanonical}" >> $@ Index: Makefile.tpl =================================================================== --- Makefile.tpl (revision 193542) +++ Makefile.tpl (working copy) @@ -238,7 +238,7 @@ POSTSTAGE1_CXX_EXPORT = \ @if target-libstdc++-v3-bootstrap # Override the above if we're bootstrapping C++. POSTSTAGE1_CXX_EXPORT = \ - CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/g++$(exeext) \ + CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \ -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \