This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mips C++ undefined reference to std::_Alloc_traits<...>::_S_instanceless


Thanks, Eric.  I appreciate your looking into this.

Here is a test case that fails for me in a similar fashion.  Including 
<ext/rope> and using optimization (-O2) seems to be one of the ways to get 
this to happen.  This test case works for my arm, ppc, sh4 and i386 ports of 
gcc-3.2.2.  The main difference I can see are the .extern's in the mips 
assembly when optimizing.

I have main.cc:

  extern int foo(int bar);
  int main(void)
  {
    return(foo(2));
  }

and shlib.cc:

  #include <ext/rope>
  int foo(int bar)
  {
    return(bar*2);
  }

Here are my command lines and output, showing undefined references in 
libshlib.so and libstdc++.so:

$ ntomips-g++ -shared -fPIC shlib.cc -olibshlib.so -O2
$ ntomips-g++ main.cc -ofoo ./libshlib.so
./libshlib.so: undefined reference to `std::_Alloc_traits<wchar_t, 
std::allocator<wchar_t> >::_S_instanceless'
./libshlib.so: undefined reference to `std::_Alloc_traits<char, 
std::allocator<char> >::_S_instanceless'
/usr/lib/gcc-lib/ntomips/3.2.2/../../../../ntomips/lib/libstdc++.so: 
undefined reference to `std::_Alloc_traits<std::string, 
std::allocator<std::string> >::_S_instanceless'
collect2: ld returned 1 exit status


Thanks again.
GP


Eric Christopher <echristo at redhat dot com> said:

> 
> > When I try to use the mips libstdc++.so, I get the following:
> > 
> > /usr/ntomips/lib/libstdc++.so: undefined reference to
> > `std::_Alloc_traits<wchar_t, std::allocator<wchar_t> >::_S_instanceless'
> > /usr/ntomips/lib/libstdc++.so: undefined reference to
> > `std::_Alloc_traits<char, std::allocator<char> >::_S_instanceless'
> > /usr/ntomips/lib/libstdc++.so: undefined reference to
> > `std::_Alloc_traits<std::string, std::allocator<std::string> 
>::_S_instanceless'
> > 
> > Anyone able to shed any light on this for me?  Anymore info I can provide 
to help?
> > 
> 
> I'm not seeing this offhand. Why don't you mail me info on how to
> duplicate, etc...
> 
> -eric
> 
> -- 
> o/~ got caught stealing fire from the sky o/~
> 
> 



-- 




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]