Bug 806598

Summary: static linking with libstdc++ fails
Product: [Fedora] Fedora Reporter: Markus Trippelsdorf <markus>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: jakub, lordmetgod, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-01 05:38:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Markus Trippelsdorf 2012-03-25 09:41:24 UTC
$ cat x.cc 
#include <iostream>
int main()
{
  std::cout << "hello\n";
}

$ g++ x.cc -static-libstdc++ 
/usr/bin/ld: a.out: No symbol version section for versioned symbol `_ZSt15future_category@@GLIBCXX_3.4.14'
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

$ ld -v
GNU ld version 2.22.52.0.1-10.fc17 20120131

Gold is fine:

$ sudo ln -f /bin/ld.gold /bin/ld
$ g++ x.cc -static-libstdc++
$

Latest git version also:

$ ld -v
GNU ld (GNU Binutils) 2.22.52.20120324
$ g++ x.cc -static-libstdc++
$

See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52689 for the original gcc bug.

Comment 1 Cody 2012-03-28 11:04:16 UTC
Just thought I'd add some additional info here that I've noticed. I backported GCC 4.7.0 to both RHEL5 and 6 linuxes (read: centos 5, centos 6, fedora 16). How is along the lines of Redhat's gcc44 package (think that's the one). I got the proper patches etc from Fedora 17 srpm (of gcc 4.7.0), and used the tarball in there for the sources. Only difference that I can think of is: I built mpfr, mpc and gmp inside the gcc sources (as in I let the gcc build it for itself). Before 4.7.0 was out I also did the same with gcc 4.6.2 (didn't notice any problems there, but I maybe didn't test as much outside my normal projects, either).

Maybe its a different bug, but I suspect it's completely related. Centos 5 does not have the additional ld's (as in, binutils is not the same version) and thus does not have this problem.

However, the issue i noticed was the same error. Only thing is: static did work. As in, -static (did not try -static-libstdc++). It was the normal linking that failed, e.g., g++ passing to ld failed. That is, until I linked /usr/bin/ld to ld.gold (in /usr at least on fedora 16). I will be more than happy to provide any other information if you like; just let me know.

Hopefully this is helpful though, because linking dynamically was the issue for me with same error, where someone else got it for static builds. I should point out that indeed I noticed it when iostream was #include'd. Indeed, the fix was to use gold instead of the default bfd.

Comment 2 Fedora End Of Life 2013-07-04 01:19:23 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2013-08-01 05:38:40 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.