[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8503: Multiple definition errors when statically linking libstdc++

From: Nathan Sharp
Subject: bug#8503: 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 

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:

 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 

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


Nathan Sharp 
Phoenix Integration Inc 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]