This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: problems with the recent snapshot (971207) (Solved)
- To: jodyg at idt dot net
- Subject: Re: problems with the recent snapshot (971207) (Solved)
- From: hjl at lucon dot org (H.J. Lu)
- Date: Tue, 9 Dec 1997 00:31:31 -0800 (PST)
- Cc: egcs at cygnus dot com
>
> On Mon, Dec 08, 1997 at 05:05:56PM -0800, H.J. Lu wrote:
> > > /tmp/cca294841.o:/home/phenning/EGCS/Build/build/libraries/libstdc++/testsuite/../../../../egcs-971207/libstdc++/testsuite/../std/bastring.h:148: undefined reference to `ostream & operator<<<char, string_char_traits<char>, __default_alloc_template<false, 0> >(ostream &, basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > const &)'
> > > [plus a lot of other similar errors]
> > >
> > > so, tstring.cc compilation and tstring.cc -O compilation fail unexpectedly.
> > >
> > > What else can I provide to help resolve this?
> >
> > Same here on i586-linux-gnu. But it was ok on i586-linux-glibc1.
> > Since egcs 971207 miscompiles things on x86, it is not that strange.
> >
>
> The patch I submitted for bastring is the source of these problems. If
> you look at the error messages carefully you'll notice
>
> undefined reference to `ostream & operator<<<char, string_char_traits<char>,
> __default_alloc_template<false, 0>
> ^^^^^
> >(ostream &, basic_string<char, string_char_traits<char>,
> __default_alloc_template<false, 0> > const &)'
> ^^^^^
> In the library you find
> basic_string<char, string_char_traits<char>,
> __default_alloc_template<true, 0> >
> ^^^^^
>
> The issue is the -D_PTHREAD during the compilation of sinst.cc.
> This causes the thread safe allocator to be used by default under Linux
> glibc2. However, _PTHREAD is NOT defined when tstring.cc is compiled and
> it attempts to use the NON-thread safe allocator which was not instantiated
> in libstdc++.
>
> I mentioned this issue with the patch but did not have a solution.
>
> What version(s) should go into the library ? SGI uses _PTHREAD in the stl
> and egcs defines it for linux in libstdc++/config/linux.mt. How should it be
> defined for general programs ?
>
I don't like to link with -lpthread for my single thread program.
Can we have both in libstdc++, like compiling anything which
includes <alloc.h> twice?
# .... -D_PTHREAD -c -o stlinst.omt stlinst.cc
# .... -c -o stlinst.o stlinst.cc
Will it work?
--
H.J. Lu (hjl@gnu.org)