From unknown Tue Jun 17 20:17:23 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8503 <8503@debbugs.gnu.org> To: bug#8503 <8503@debbugs.gnu.org> Subject: Status: Multiple definition errors when statically linking libstdc++ Reply-To: bug#8503 <8503@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:17:23 +0000 retitle 8503 Multiple definition errors when statically linking libstdc++ reassign 8503 libtool submitter 8503 Nathan Sharp severity 8503 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 14 20:23:04 2011 Received: (at submit) by debbugs.gnu.org; 15 Apr 2011 00:23:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QAWoR-0007KJ-Bp for submit@debbugs.gnu.org; Thu, 14 Apr 2011 20:23:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QAWnt-0007Iz-GS for submit@debbugs.gnu.org; Thu, 14 Apr 2011 20:22:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAWnn-0004K6-I6 for submit@debbugs.gnu.org; Thu, 14 Apr 2011 20:22:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:52310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAWnn-0004K2-GT for submit@debbugs.gnu.org; Thu, 14 Apr 2011 20:22:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]:56024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAWnm-0005gP-Nf for bug-libtool@gnu.org; Thu, 14 Apr 2011 20:22:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAWnl-0004Js-MJ for bug-libtool@gnu.org; Thu, 14 Apr 2011 20:22:22 -0400 Received: from blacksburg.phoenix-int.com ([216.252.204.129]:35822 helo=spyder.phoenix-int.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAWnl-0004Jl-Jy for bug-libtool@gnu.org; Thu, 14 Apr 2011 20:22:21 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by spyder.phoenix-int.com (Postfix) with ESMTP id 618D18CF8050 for ; Thu, 14 Apr 2011 20:22:20 -0400 (EDT) X-Virus-Scanned: amavisd-new at spyder.phoenix-int.com Received: from spyder.phoenix-int.com ([127.0.0.1]) by localhost (spyder.phoenix-int.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VBZo1r1cujHo for ; Thu, 14 Apr 2011 20:22:19 -0400 (EDT) Received: from spyder.phoenix-int.com (spyder.phoenix-int.com [10.10.10.25]) by spyder.phoenix-int.com (Postfix) with ESMTP id 5017A8CF8042 for ; Thu, 14 Apr 2011 20:22:19 -0400 (EDT) Date: Thu, 14 Apr 2011 20:22:19 -0400 (EDT) From: Nathan Sharp To: bug-libtool@gnu.org Message-ID: <1003573595.106584.1302826939236.JavaMail.root@spyder.phoenix-int.com> In-Reply-To: <126862491.106574.1302825724358.JavaMail.root@spyder.phoenix-int.com> Subject: Multiple definition errors when statically linking libstdc++ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.10.10.50] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Linux)/6.0.10_GA_2692) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 14 Apr 2011 20:23:01 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) 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, std::allocator >::~basic_ostringstream()]+0x0): multiple definition of `std::basic_ostringstream, std::allocator >::~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