public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "walther at caltech dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/13805] New: undefined symbol when linking libstdc++.a
Date: Thu, 22 Jan 2004 02:12:00 -0000	[thread overview]
Message-ID: <20040122021202.13805.walther@caltech.edu> (raw)

This has been reported before but not resolved (#12595). 

When trying to build a shared library with libstdc++ linked in statically (for
self-containment), the symbol std::time_put_w@@GLIBCPP_3.2 is undefined:
//test.cpp
#include<iostream>
void doit()
{
   std::cout << "Hello World!\n";
}
//end test.cpp

g++ -shared -static -v -Wl,-v -o test.so test.cpp
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libstdc++.a
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cc1plus -v -D__GNUC__=3
-D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__
-Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__
-D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1
-D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__
-D__tune_i386__ test.cpp -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet
-dumpbase test.cpp -version -o /tmp/cc2HiSkY.s
GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux)
        compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.2.2
 /usr/include/c++/3.2.2/i386-redhat-linux
 /usr/include/c++/3.2.2/backward
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include
 /usr/include
End of search list.
 as -V -Qy -o /tmp/ccvdM737.o /tmp/cc2HiSkY.s
GNU assembler version 2.13.90.0.18 (i386-redhat-linux) using BFD version
2.13.90.0.18 20030206
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/collect2 -m elf_i386 -shared -o
test.so /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crti.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtbeginT.o
-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2
-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.. -v /tmp/ccvdM737.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libstdc++.a -lstdc++ -lm -lgcc -lgcc_eh
-lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtendS.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crtn.o
collect2 version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386 Linux/ELF)
/usr/bin/ld -m elf_i386 -shared -o test.so
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crti.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtbeginT.o
-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2
-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.. -v /tmp/ccvdM737.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libstdc++.a -lstdc++ -lm -lgcc -lgcc_eh
-lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtendS.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crtn.o
/usr/bin/ld: test.so: undefined versioned symbol name std::time_put_w@@GLIBCPP_3.2
/usr/bin/ld: failed to set dynamic section sizes: Bad value
GNU ld version 2.13.90.0.18 20030206
collect2: ld returned 1 exit status


I have reproduced the problem in gcc versions 3.2.2 and 3.3.2. It was not
present in 3.1. I have tried a RedHat 8.0 and a Mandrake 9.2 system. I have
tried bootstrapping the compilers from scratch, also with the previously
suggested --with-pic option - the problem persists. 

In libstdc++.a the symbol time_put_w is versioned, which it did not use to be in
gcc 3.1:
nm /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libstdc++.a | grep time_put_w
00000000 B _ZN9__gnu_cxx10time_put_wE
00000000 B _ZSt10time_put_w@@GLIBCPP_3.2
         U _ZN9__gnu_cxx10time_put_wE
nm: stubs.o: no symbols

Please help!

Dirk

-- 
           Summary: undefined symbol when linking libstdc++.a
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: walther at caltech dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


             reply	other threads:[~2004-01-22  2:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-22  2:12 walther at caltech dot edu [this message]
2004-01-24 16:24 ` [Bug libstdc++/13805] " dhazeghi at yahoo dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040122021202.13805.walther@caltech.edu \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).