diff mbox

-static-libstdc++ breaks building gdb

Message ID CBD32A0D-4296-49CA-B5A5-6147011AEA84@comcast.net
State New
Headers show

Commit Message

Mike Stump Sept. 3, 2013, 9:39 p.m. UTC
I'm on a openSUSE 11.4 system with a:

gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]

host compiler.  When I building gdb trunk, I get a failure to build because configure tests g++ to see if these work, but gdb links with gcc and 4.5.1 errors out with the flag.  You can't set LDFLAGS, because that is given to gcc, without testing the flag with gcc.  So, either:

AC_LANG_PUSH(C++)

goes away, or we need to exclude 4.5 as well.  I tested the first approach and while it gives a message, it doesn't fail the link, so short of rewriting the test, we need to bump the minor number up 1.  I make no claim that 4.6.0 doesn't also fail.

If someone knows when the driver was made to error out with the proper return code, it would be better to put that into the test instead.

Here is the failure trying to make the first approach work:

configure:4926: checking whether gcc accepts -static-libstdc++ -static-libgcc
configure:4937: gcc -o conftest -g -O2   -static-libstdc++ -static-libgcc conftest.c  >&5
gcc: unrecognized option '-static-libstdc++'
configure:4937: $? = 0
configure:4938: result: yes


Ok?

Comments

Mike Stump Sept. 3, 2013, 9:54 p.m. UTC | #1
On Sep 3, 2013, at 2:39 PM, Mike Stump <mikestump@comcast.net> wrote:
> I'm on a openSUSE 11.4 system with a:
> 
> gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
> 
> host compiler.  When I building gdb trunk, I get a failure to build because configure tests g++ to see if these work, but gdb links with gcc and 4.5.1 errors out with the flag.  You can't set LDFLAGS, because that is given to gcc, without testing the flag with gcc.

Hum, I was confused by other build errors.  I was assuming that the diagnostic:

gcc: unrecognized option '-static-libstdc++'

was necessary to fix to get the link to not fail.  I was wrong.  It is however, unsightly.
Mike Frysinger Sept. 3, 2013, 10:07 p.m. UTC | #2
On Tuesday 03 September 2013 17:39:10 Mike Stump wrote:
> host compiler.  When I building gdb trunk, I get a failure to build because
> configure tests g++ to see if these work, but gdb links with gcc and 4.5.1
> errors out with the flag.  You can't set LDFLAGS, because that is given to
> gcc, without testing the flag with gcc.  So, either:

it's a bug in gcc code.  random subdirs (like binutils) shouldn't be working 
around it:
	http://gcc.gnu.org/PR56750
-mike
diff mbox

Patch

diff --git a/binutils/configure b/binutils/configure
index a2671fb..d9cb7b8 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -4981,7 +4981,7 @@  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
 #error -static-libstdc++ not implemented
 #endif
 int main() {}
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 04cf83f..c819263 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -1269,7 +1269,7 @@  if test "$GCC" = yes; then
   AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
   AC_LANG_PUSH(C++)
   AC_LINK_IFELSE([
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
 #error -static-libstdc++ not implemented
 #endif
 int main() {}],