Bug#739891: libstdc++: -static-libstdc++ broken
Package: libstdc++-4.8-dev
Version: 4.8.2-15
Severity: important
File: libstdc++
Tags: upstream
Dear Maintainer,
-static-libstdc++ does not seem to be working anymore.
Consider this following test application:
---------------------
#include <iostream>
#include <string>
int main()
{
std::string s;
if (s.empty()) { std::cout << "String is empty!" << std::endl; }
return(0);
}
---------------------
g++ -Wall -o test test.cpp -static-libgcc -static-libstdc++
"test" here should not contain any references to libstdc++ symbols as it is being linked statically, however, "objdump -T test" contains the following:
00000000006915c0 u DO .bss 0000000000000020 Base _ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE
0000000000691600 u DO .bss 0000000000000020 Base _ZNSs4_Rep20_S_empty_rep_storageE
These are both symbols from libstdc++ that should have been staticaly linked, yet they are now undefined, and indeed, this binary will not run on a system without a sufficiently up to date libstdc++ installed.
The same problem occurs with:
clang++ -Wall -o test test.cpp -static-libgcc -static-libstdc++
So the problem seems to be more of an interaction with libstdc++ and the linker than the compiler in question.
An older Debian setup I have back when GCC 4.6 was current does not exhibit the problem here.
-- System Information:
Debian Release: 7.4
APT prefers stable
APT policy: (900, 'stable'), (800, 'testing'), (500, 'stable-updates')
Architecture: amd64 (x86_64)
Kernel: Linux 3.11.6-x86_64-linode35 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libstdc++-4.8-dev:amd64 depends on:
ii gcc-4.8-base 4.8.2-15
ii libc6-dev 2.17-97
ii libgcc-4.8-dev 4.8.2-15
ii libstdc++6 4.8.2-15
libstdc++-4.8-dev:amd64 recommends no packages.
Versions of packages libstdc++-4.8-dev:amd64 suggests:
pn libstdc++-4.8-doc <none>
-- debconf-show failed
Reply to: