libstdc++ 3.x causes linker errors

Dara Hazeghi dhazeghi@greenpebble.net
Sat Oct 27 08:18:00 GMT 2012


I'm trying to build a number of older various of gcc/g++ for a project. 
  Host is x86_64 running Ubuntu 12.04/gcc 4.6.

I can bootstrap gcc-3.4.6 (c,c++ enabled), but the resulting libstdc++ 
causes linker errors:

dara@kestrel:~$ cat hello.cc
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
	cout << "hi there" << endl;
	return 0;
}

dara@kestrel:~$ g++-3.4 hello.cc
/usr/bin/ld: a.out: hidden symbol `fstat' in 
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(fstat.oS) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status

This is with glibc 2.15.

I get a similar error with g++-3.3.x, except it occurs during bootstrap 
when linking the abicheck program.

Oddly g++ 3.2.x and 32-bit compilations with 3.3.x and 3.4.x do not seem 
to have this problem.

Any suggestions for a workaround/solution?  Thanks,

Dara



More information about the Gcc-help mailing list