STL/thread-safe/template problem on Alpha.

Wegher, Jeff JWegher@neonsoft.com
Wed Sep 9 19:28:00 GMT 1998


Hello...

Hopefully I'm not wasting your time with a well-known problem, but I
don't see this in the bug-list archives...

I've run into a problem with the static data members of the
__default_alloc_template template class (from stl_alloc.h) on the Alpha
(alphaev56-dec-osf4.0b) with the 1.1a (egcs-2.91.57) build when
attempting to compile a program with threading enabled.

This is as simple as I can make it:

#include <list>
int main() { list<int> aList; return 0; }

Compiling this tiny program with:

g++ -D__STL_PTHREADS -D_REENTRANT testList.cpp -lpthread

Comes back with:

/usr/bin/ld:
Unresolved:
__default_alloc_template<1, 0>::end_free  
__default_alloc_template<1, 0>::start_free  
__default_alloc_template<1, 0>::heap_size  
__default_alloc_template<1, 0>::free_list  
__default_alloc_template<1, 0>::__node_allocator_lock  
collect2: ld returned 1 exit status

The same code compiles fine under Solaris (sparc-sun-solaris2.5.1) which
was built with the same options (--enable-shared --enable-threads).  It
also compiles fine without the defines to make the STL thread-safe.

It doesn't appear to just be a problem with static data members of
template classes in general as I've tried some fairly involved cases,
and they compile fine.

Any ideas/workarounds?  

Thanks,

Jeff




More information about the Gcc-bugs mailing list