GNU bug report logs - #8503
Multiple definition errors when statically linking libstdc++

Previous Next

Package: libtool;

Reported by: Nathan Sharp <nsharp <at> phoenix-int.com>

Date: Fri, 15 Apr 2011 00:24:01 UTC

Severity: normal

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nathan Sharp <nsharp <at> phoenix-int.com>
To: bug-libtool <at> gnu.org
Subject: Multiple definition errors when statically linking libstdc++
Date: Thu, 14 Apr 2011 20:22:19 -0400 (EDT)
Libtool is adding on libstdc++.dll.a, even when -static-libstdc++ option is specified.

We are building a DLL on Windows XP using MinGW.  Due to what appears to be a performance bug in MinGW, we'd like to statically link libstdc++.  Attempting to use CXXFLAGS="-static-libstdc++" seems to get very close to working, but libtool tries to link on libstdc++.dll.a even with this flag set and we end up getting errors such as:

C:/MinGW/lib/gcc/mingw32/4.5.2\libstdc++.a(sstream-inst.o):(.text$_ZNSt19basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev[std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()]+0x0): multiple definition of `std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()'
C:/MinGW/lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d002250.o):(.text+0x0): first defined here

I found that passing -all-static to libtool fixes the problem.  However, -all-static is not a valid g++ option, and I can't figure out how to pass an option just to libtool and not to g++ from configure.  I'm currently working around this (incorrectly) by adding the option to Makefile.am under progname_LDFLAGS.

Why shouldn't libtool drop libstdc++.dll.a from the arguments to the linker when -static-libstdc++ is present, though?  

libtool 2.4
g++ 4.5.2

Thanks!
  Nathan


------------------------------------------------ 
Nathan Sharp 
Phoenix Integration Inc 
www.phoenix-int.com 







This bug report was last modified 14 years and 67 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.