From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31605 invoked by alias); 25 Sep 2012 01:53:36 -0000 Received: (qmail 29022 invoked by uid 48); 25 Sep 2012 01:53:05 -0000 From: "baker at usgs dot gov" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/54630] [4.8 Regression] GCC 4.8 --enable-languages=c build fails: Undefined symbols: ___cxa_guard_acquire and ___cxa_guard_release Date: Tue, 25 Sep 2012 01:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: blocker X-Bugzilla-Who: baker at usgs dot gov X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg01994.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54630 --- Comment #9 from Larry Baker 2012-09-25 01:53:01 UTC --- The build on Linux i386 works fine without --with-host-libstdcxx. I believe g++ is used for linking. I tried using a native Linux i386 GCC 4.7.1 to build a cross GCC 4.8.0, with --with-host-libstdcxx='-static-libgcc -static-libstdc++'. That fails with the same error I encountered before: undefined references to __cxa_guard_acquire and __cxa_guard_release in the link step. I am sure this is because gcc was used and libstdc++ was not searched because I did not include -lstdc++ in --with-host-libstdcxx. Lastly, I hacked gcc/Makefile.in to always use g++ for the linker: # Libraries to use on the host. HOST_LIBS = @HOST_LIBS@ # The name of the compiler to use. COMPILER = $(CXX) COMPILER_FLAGS = $(CXXFLAGS) # If HOST_LIBS is set, then the user is controlling the libraries to # link against. In that case, link with $(CC) so that the -lstdc++ # library is not introduced. If HOST_LIBS is not set, link with # $(CXX) to pick up -lstdc++. #---> ifeq ($(HOST_LIBS),) LINKER = $(CXX) LINKER_FLAGS = $(CXXFLAGS) #---> else #---> LINKER = $(CC) #---> LINKER_FLAGS = $(CFLAGS) #---> endif # ( cd cross-gcc-4.8.0-experimental ; PATH=/usr/local/gcc-4.7.1/bin:${PWD}/../freescale-coldfire-2011.09/bin:${PATH/.:/} CC_FOR_BUILD=gcc CC=gcc CXX=g++ AR=ar RANLIB=ranlib AS_FOR_TARGET=m68k-uclinux-as LD_FOR_TARGET=m68k-uclinux-ld AR_FOR_TARGET=m68k-uclinux-ar RANLIB_FOR_TARGET=m68k-uclinux-ranlib NM_FOR_TARGET=m68k-uclinux-nm OBJDUMP_FOR_TARGET=m68k-uclinux-objdump STRIP_FOR_TARGET=m68k-uclinux-strip ${PWD}/../gcc-4.8.0-experimental/configure --disable-decimal-float --disable-fixed-point --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --enable-languages=c,c++ --enable-lto --enable-poison-system-directories --enable-threads --prefix=/usr/local/gcc-4.8.0 --program-prefix=m68k-uclinux- --target=m68k-uclinux --with-arch=cf --with-gnu-as --with-gnu-ld --with-build-time-tools=${PWD}/../freescale-coldfire-2011.09/m68k-uclinux/bin --with-host-libstdcxx='-static-libgcc -static-libstdc++' --with-sysroot=${PWD}/../freescale-coldfire-2011.09/m68k-uclinux/libc ) # ( cd cross-gcc-4.8.0-experimental ; PATH=/usr/local/gcc-4.7.1/bin:${PWD}/../freescale-coldfire-2011.09/bin:${PATH/.:/} make -j4 ) # ( cd cross-gcc-4.8.0-experimental ; PATH=/usr/local/gcc-4.7.1/bin:${PWD}/../freescale-coldfire-2011.09/bin:${PATH/.:/} make install ) This works fine. This is as close as I could get to supplying LDFLAGS_FOR_BUILD='-static-libgcc -static-libstdc++' to the link step without causing LINKER=gcc.