public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17859] New: cannot create statically linked shared library
@ 2004-10-06 10:05 info at yourkit dot com
  2004-10-06 10:07 ` [Bug c++/17859] " info at yourkit dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: info at yourkit dot com @ 2004-10-06 10:05 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/17859] cannot create statically linked shared library
  2004-10-06 10:05 [Bug c++/17859] New: cannot create statically linked shared library info at yourkit dot com
@ 2004-10-06 10:07 ` info at yourkit dot com
  2004-10-06 11:30 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: info at yourkit dot com @ 2004-10-06 10:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From info at yourkit dot com  2004-10-06 10:07 -------
I'm using Linux Fedora Core1

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17859


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/17859] cannot create statically linked shared library
  2004-10-06 10:05 [Bug c++/17859] New: cannot create statically linked shared library info at yourkit dot com
  2004-10-06 10:07 ` [Bug c++/17859] " info at yourkit dot com
@ 2004-10-06 11:30 ` pinskia at gcc dot gnu dot org
  2004-10-06 11:49 ` info at yourkit dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-06 11:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-06 11:29 -------


*** This bug has been marked as a duplicate of 12462 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17859


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/17859] cannot create statically linked shared library
  2004-10-06 10:05 [Bug c++/17859] New: cannot create statically linked shared library info at yourkit dot com
  2004-10-06 10:07 ` [Bug c++/17859] " info at yourkit dot com
  2004-10-06 11:30 ` pinskia at gcc dot gnu dot org
@ 2004-10-06 11:49 ` info at yourkit dot com
  2004-10-06 11:53 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: info at yourkit dot com @ 2004-10-06 11:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From info at yourkit dot com  2004-10-06 11:49 -------
This bug is not fixed in 3.4.0. I'm using GCC 3.4.2 and report problem against
3.4.2. Please reopen this bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17859


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/17859] cannot create statically linked shared library
  2004-10-06 10:05 [Bug c++/17859] New: cannot create statically linked shared library info at yourkit dot com
                   ` (2 preceding siblings ...)
  2004-10-06 11:49 ` info at yourkit dot com
@ 2004-10-06 11:53 ` pinskia at gcc dot gnu dot org
  2004-10-06 12:05 ` info at yourkit dot com
  2004-10-06 12:43 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-06 11:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-06 11:52 -------
Read the other bug fully:
"If you want to link libstdc++ into a shared library, you shouldn't 
use the static version. I think that's only a reasonable requirement 
the linker is enforcing. "

*** This bug has been marked as a duplicate of 12462 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17859


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/17859] cannot create statically linked shared library
  2004-10-06 10:05 [Bug c++/17859] New: cannot create statically linked shared library info at yourkit dot com
                   ` (3 preceding siblings ...)
  2004-10-06 11:53 ` pinskia at gcc dot gnu dot org
@ 2004-10-06 12:05 ` info at yourkit dot com
  2004-10-06 12:43 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: info at yourkit dot com @ 2004-10-06 12:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From info at yourkit dot com  2004-10-06 12:05 -------
But the problem is that I need to create shared library without references to
other shared libraries. To achieve this I'm statically linking necessary code
from libstdc++.a. It's possible to do and linker also allows this. Moreover
everything is working (compiling and linking) until I use <iostream>

For example, I can compile the following code:

#include <vector>

extern "C" {
  void Java_com_yourkit_hello_sayHello(){
     std::vector<int> v;
  }
}

and cannot compile

#include <vector>
#include <iostream> // the only difference

extern "C" {
  void Java_com_yourkit_hello_sayHello(){
     std::vector<int> v;
  }
}

It's strange, because I'm using nothing from <iostream>



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17859


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/17859] cannot create statically linked shared library
  2004-10-06 10:05 [Bug c++/17859] New: cannot create statically linked shared library info at yourkit dot com
                   ` (4 preceding siblings ...)
  2004-10-06 12:05 ` info at yourkit dot com
@ 2004-10-06 12:43 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-06 12:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-06 12:42 -------
Did you read the bug, it is the same problem.  If you want to use the static library configure gcc with --
disable-shared.

*** This bug has been marked as a duplicate of 12462 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17859


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-06 12:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-06 10:05 [Bug c++/17859] New: cannot create statically linked shared library info at yourkit dot com
2004-10-06 10:07 ` [Bug c++/17859] " info at yourkit dot com
2004-10-06 11:30 ` pinskia at gcc dot gnu dot org
2004-10-06 11:49 ` info at yourkit dot com
2004-10-06 11:53 ` pinskia at gcc dot gnu dot org
2004-10-06 12:05 ` info at yourkit dot com
2004-10-06 12:43 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).