This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/12595] New: link problems with static libstdc++
- From: "marek dot rouchal at infineon dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Oct 2003 10:22:38 -0000
- Subject: [Bug libstdc++/12595] New: link problems with static libstdc++
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12595
Summary: link problems with static libstdc++
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: marek dot rouchal at infineon dot com
CC: gcc-bugs at gcc dot gnu dot org
This problem was reported a couple of times in the gcc-help mailing
list, but was not answered (I browsed the email archives). See e.g.:
http://gcc.gnu.org/ml/libstdc++/2002-12/msg00129.html
I saw the problem first in gcc-3.2 and it is everywhere up to gcc-3.3.
I could not test 3.3.1 yet. The problem is NOT in 2.96 and NOT in 3.1.1.
In a nutshell, I am trying to build *.so libs from C++ code, that include
a static copy of libstdc++ for self-containment reasons.
Example:
Consider this file: hsw.cpp
#include <iostream>
void
smw()
{
std::cout << "Hello, static world!\n";
}
$ g++ -print-file-name=libstdc++.a
/opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../../libstdc++.a
$ ls -la /opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-
gnu/3.3/../../../libstdc++.a
-rw-r--r-- 1 cei cei 7897890 May 31
02:06 /opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../../libstdc++.a
$ g++ -save-temps -v -shared -o hsw.so hsw.cpp /opt/TWWfsw/gcc33/lib/gcc-
lib/i686-pc-linux-gnu/3.3/../../../libstdc++.a
Reading specs from /opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: /opt/build/gcc-3.3/configure --with-included-gettext --enable-
libgcj --enable-__cxa_atexit --with-gnu-as --with-as=/opt/TWWfsw/gcc33/i686-pc-
linux-gnu/bin/as --with-gnu-ld --with-ld=/opt/TWWfsw/gcc33/i686-pc-linux-
gnu/bin/ld --datadir=/opt/TWWfsw/gcc33/share --with-local-
prefix=/opt/TWWfsw/gcc33 --prefix=/opt/TWWfsw/gcc33
Thread model: posix
gcc version 3.3 (TWW)
/opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-gnu/3.3/cc1plus -E -D__GNUG__=3 -
quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D_GNU_SOURCE
hsw.cpp hsw.ii
ignoring nonexistent directory "/opt/TWWfsw/gcc33/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/TWWfsw/gcc33/include/c++/3.3
/opt/TWWfsw/gcc33/include/c++/3.3/i686-pc-linux-gnu
/opt/TWWfsw/gcc33/include/c++/3.3/backward
/opt/TWWfsw/gcc33/include
/opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-gnu/3.3/include
/usr/include
End of search list.
/opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-gnu/3.3/cc1plus -fpreprocessed
hsw.ii -quiet -dumpbase hsw.cpp -auxbase hsw -version -o hsw.s
GNU C++ version 3.3 (TWW) (i686-pc-linux-gnu)
compiled by GNU C version 3.3 (TWW).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
/opt/TWWfsw/gcc33/i686-pc-linux-gnu/bin/as -V -Qy -o hsw.o hsw.s
GNU assembler version 2.12.1 (i686-pc-linux-gnu) using BFD version 2.12.1
/opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-gnu/3.3/collect2 --eh-frame-hdr -m
elf_i386 -shared -o hsw.so /usr/lib/crti.o /opt/TWWfsw/gcc33/lib/gcc-lib/i686-
pc-linux-gnu/3.3/crtbeginS.o -L/usr/local/bin -L/opt/TWWfsw/gcc33/lib/gcc-
lib/i686-pc-linux-gnu/3.3 -L/opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-
gnu/3.3/../../../../i686-pc-linux-gnu/lib -L/opt/TWWfsw/gcc33/lib/gcc-lib/i686-
pc-linux-gnu/3.3/../../.. hsw.o /opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-
gnu/3.3/../../../libstdc++.a -lstdc++ -lm -rpath /opt/TWWfsw/gcc33r/lib -
lgcc_s -lc -lgcc_s /opt/TWWfsw/gcc33/lib/gcc-lib/i686-pc-linux-
gnu/3.3/crtendS.o /usr/lib/crtn.o
/opt/TWWfsw/gcc33/i686-pc-linux-gnu/bin/ld: hsw.so: undefined versioned symbol
name std::time_put_w@@GLIBCPP_3.2
/opt/TWWfsw/gcc33/i686-pc-linux-gnu/bin/ld: failed to set dynamic section
sizes: Bad value
collect2: ld returned 1 exit status