gcc 4.0.0 x86_64 static linking of libstdc++.a

Roland Lengfeldner lengfeldner_roland@gmx.at
Mon May 23 15:08:00 GMT 2005


Hello,

I'm facing the following problem: I want to create a shared library on Linux
(Red Hat Enterprise 3) / Opteron, with gcc 4.0.0 & binutils 2.16. When
compiling in 32-bit mode (with -m32) everything works, but in 64-bit mode
(with -m64) the following error message appears:

gcc -shared   {list of .o files}  -ldl -lm

/opt/dessup/gnu_2004/gcc400/opt3/lib/gcc/x86_64-unknown-linux-gnu/4.0.0/../../../../lib64/libstdc++.a
 -m64 -static-libgcc -fPIC 
-Wl,-soname -Wl,libAGENT.so.1 -o .libs/libAGENT.so.1.0.0

/opt/dessup/gnu_2004/gcc400/opt3/bin/ld:
/opt/dessup/gnu_2004/gcc400/opt3/lib/gcc/x86_64-unknown-linux-gnu/4.0.0/../../../../lib64/libstdc++.a(functexcept.o):
relocation R_X86_64_32 against `std::bad_typeid::~bad_typeid()' can not be
used when making a shared object; recompile with
-fPIC
/opt/dessup/gnu_2004/gcc400/opt3/lib/gcc/x86_64-unknown-linux-gnu/4.0.0/../../../../lib64/libstdc++.a:
could not read symbols: Bad value
collect2: ld returned 1 exit status

all object files were compiled with the following switches (c/c++): -O3 
-fno-exception -m64 -fPIC

What does the error message mean? Is gcc 4.0.0 (or at least libstdc++.a)
miscompiled, or is it a gcc configuration problem:

gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/gcc_compile/opt3/gcc-4.0.0/configure 
--prefix=/opt/dessup/gnu_2004/gcc400/opt3 --disable-nls --disable-werror 
--with-local-prefix=/opt/dessup/gnu_2004/tools/opt3 --with-gnu-as 
--with-as=/opt/dessup/gnu_2004/gcc400/opt3/bin/as --with-gnu-ld 
--with-ld=/opt/dessup/gnu_2004/gcc400/opt3/bin/ld 
--enable-languages=c,c++,objc,java
Thread model: posix
gcc version 4.0.0

thanks for your time,
Roland Lengfeldner

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++



More information about the Gcc-help mailing list