This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17859] New: cannot create statically linked shared library
- From: "info at yourkit dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Oct 2004 10:05:42 -0000
- Subject: [Bug c++/17859] New: cannot create statically linked shared library
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I'm trying to create shared library statically linked with libstdc++ to avoid
dependencies to other libraries.
Here is very simple C++ code that demonstrates the problem:
#include <iostream>
extern "C" {
void Java_com_yourkit_hello_sayHello(){
}
}
I'm using the following command line to compile and link the code:
gcc -shared -fPIC -c *.cpp
gcc -shared -fPIC -static -nostdlib *.o `g++ -print-file-name=libstdc++.a` `g++
-print-file-name=libgcc_eh.a` -o hello.so
I'm getting the following error:
/usr/bin/ld: hello.so: undefined versioned symbol name std::time_put_w@@GLIBCPP_3.2
/usr/bin/ld: failed to set dynamic section sizes: Bad value
If I comment #include<iostream> line then everything is OK. BTW, if I use
#include <vector> without <iostream> then everything is also OK (eveb if class
vector is used in the code).
--
Summary: cannot create statically linked shared library
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: info at yourkit dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17859