CC 5.0: shared libraries refuse to close - missing inline template functions!

CC 5.0: shared libraries refuse to close - missing inline template functions!

Post by Chris Ranki » Thu, 06 Jul 2000 04:00:00



Hi,
I was experimenting with shared objects on Solaris 2.6 using CC 5.0, and
I noticed that no matter what I did, shared objects were always missing
some symbols; specifically, implementations of inline template functions
(I think). I have created an example below:

$ cat inline.cpp
#include <string>
using std::string;

string::size_type
thing_with_string(string &s)
{
  s += "How long";
  s += '?';
  return s.length();

Quote:}

$ CC +w2 -xO2 -KPIC -ztext -G -o inline.so inline.cpp -lCrun -lc

$ ldd -r inline.so
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libw.so.1 =>     /usr/lib/libw.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        symbol not found:
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_            
(./inline.so)
        /usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1
        symbol not found:
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_        
(./inline.so)

$ c++filt
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_
std::basic_string<char,std::char_traits<char>,std::allocator<char>

Quote:>&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::replace(unsigned,unsigned,unsigned,char)

__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_
char*std::basic_string<char,std::char_traits<char>,std::allocator<char>

Quote:>::replace(unsigned,unsigned,const char*,unsigned,unsigned,unsigned)

I think that this must be a compiler bug, because I have searched
docs.sun.com extensively and the part about building shared libraries is
very brief: no gotchas such as the above at all. It seems to expect
everything to "just work", the way that it "just works" for executables.
Unfortunately, I *cannot* have unresolved symbols in this object because
I need to load it via dlopen().

Can anyone confirm this, please? Or maybe even show me what I've missed?
We haven't patched our compiler since February 2000 and I know that
there has been a new compiler patch released in the last month, so if
anyone who *has* installed the patch can confirm / refute this problem
then that would be useful too.

Cheers,
Chris

 
 
 

CC 5.0: shared libraries refuse to close - missing inline template functions!

Post by Ingo Dahm - SAP-Sun CC Walldor » Wed, 19 Jul 2000 04:00:00


Try linking with -lCstd...

    -ingo

Quote:> Hi,
> I was experimenting with shared objects on Solaris 2.6 using CC 5.0, and
> I noticed that no matter what I did, shared objects were always missing
> some symbols; specifically, implementations of inline template functions
> (I think). I have created an example below:

> $ cat inline.cpp
> #include <string>
> using std::string;

> string::size_type
> thing_with_string(string &s)
> {
>   s += "How long";
>   s += '?';
>   return s.length();
> }

> $ CC +w2 -xO2 -KPIC -ztext -G -o inline.so inline.cpp -lCrun -lc

> $ ldd -r inline.so
>         libCrun.so.1 =>  /usr/lib/libCrun.so.1
>         libc.so.1 =>     /usr/lib/libc.so.1
>         libw.so.1 =>     /usr/lib/libw.so.1
>         libdl.so.1 =>    /usr/lib/libdl.so.1
>         symbol not found:
> __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_
> (./inline.so)
>         /usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1
>         symbol not found:
> __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_
> (./inline.so)

> $ c++filt
> __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_
> std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::replace(unsigned,unsigned,unsigned,char)
> __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_
> char*std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >::replace(unsigned,unsigned,const char*,unsigned,unsigned,unsigned)

> I think that this must be a compiler bug, because I have searched
> docs.sun.com extensively and the part about building shared libraries is
> very brief: no gotchas such as the above at all. It seems to expect
> everything to "just work", the way that it "just works" for executables.
> Unfortunately, I *cannot* have unresolved symbols in this object because
> I need to load it via dlopen().

> Can anyone confirm this, please? Or maybe even show me what I've missed?
> We haven't patched our compiler since February 2000 and I know that
> there has been a new compiler patch released in the last month, so if
> anyone who *has* installed the patch can confirm / refute this problem
> then that would be useful too.

> Cheers,
> Chris

--
------------------------------------------------------------------
Ingo Dahm                               Sun Microsystems Inc - MDE
                                        Global SAP-Sun CC
                                        Altrottstr. 31
                                        69190 Walldorf, Germany

                                        Phone:  +49-6227-356-233
                                                +49-6227-7-43454
                                        Fax:    +49-6227-356-209
                                                +49-6227-356-222

 
 
 

CC 5.0: shared libraries refuse to close - missing inline template functions!

Post by Chris Ranki » Thu, 20 Jul 2000 04:00:00



Quote:

> Try linking with -lCstd...
> > $ cat inline.cpp
> > #include <string>
> > using std::string;

> > string::size_type
> > thing_with_string(string &s)
> > {
> >   s += "How long";
> >   s += '?';
> >   return s.length();
> > }

> > $ CC +w2 -xO2 -KPIC -ztext -G -o inline.so inline.cpp -lCrun -lc

> > $ ldd -r inline.so
> >         libCrun.so.1 =>  /usr/lib/libCrun.so.1
> >         libc.so.1 =>     /usr/lib/libc.so.1
> >         libw.so.1 =>     /usr/lib/libw.so.1
> >         libdl.so.1 =>    /usr/lib/libdl.so.1
> >         symbol not found:
> > __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_
> > (./inline.so)
> >         /usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1
> >         symbol not found:
> > __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_
> > (./inline.so)

> > $ c++filt
> > __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_
> > std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::replace(unsigned,unsigned,unsigned,char)
> > __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_
> > char*std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::replace(unsigned,unsigned,const char*,unsigned,unsigned,unsigned)

Hi,
I tried that, but libCstd.a is not position-independent code. How can I
create a fully-locatable shared object? I have also tried adding
-D_RWSTD_COMPILE_INSTANTIATE (or something similar) to the command line
with no effect.

Cheers,
Chris

 
 
 

CC 5.0: shared libraries refuse to close - missing inline template functions!

Post by lad.. » Fri, 21 Jul 2000 04:00:00


 Every time in Solaris 8 when I try to start httpd from root (or on
start up), Apache reports an error:

 #./apachectl start
   httpd could not be started

 The error log: /var/apache/logs/error_log reports:
 getpeername: Socket operation on non-socket
 getsockname: Socket operation on non-socket
 Error getting local address

 Thanks for any help:
 Dave

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

CC 5.0: shared libraries refuse to close - missing inline template functions!

Post by vuthyth.. » Mon, 31 Jul 2000 04:00:00


Make sure your serverType is configured correctly.  The default setting
is usually standalone.



>  Every time in Solaris 8 when I try to start httpd from root (or on
> start up), Apache reports an error:

>  #./apachectl start
>    httpd could not be started

>  The error log: /var/apache/logs/error_log reports:
>  getpeername: Socket operation on non-socket
>  getsockname: Socket operation on non-socket
>  Error getting local address

>  Thanks for any help:
>  Dave

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

1. SUN CC 5.0: shared libraries refuse to close - missing inline template functions!

Hi,
I was experimenting with shared objects on Solaris 2.6 using CC 5.0, and
I noticed that no matter what I did, shared objects were always missing
some symbols; specifically, implementations of inline template functions
(I think). I have created an example below:

$ cat inline.cpp
#include <string>
using std::string;

string::size_type
thing_with_string(string &s)
{
  s += "How long";
  s += '?';
  return s.length();

$ CC +w2 -xO2 -KPIC -ztext -G -o inline.so inline.cpp -lCrun -lc

$ ldd -r inline.so
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libw.so.1 =>     /usr/lib/libw.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        symbol not found:
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_            
(./inline.so)
        /usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1
        symbol not found:
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_        
(./inline.so)

$ c++filt
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIIc_r1_
std::basic_string<char,std::char_traits<char>,std::allocator<char>
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_
char*std::basic_string<char,std::char_traits<char>,std::allocator<char>

I think that this must be a compiler bug, because I have searched
docs.sun.com extensively and the part about building shared libraries is
very brief: no gotchas such as the above at all. It seems to expect
everything to "just work", the way that it "just works" for executables.
Unfortunately, I *cannot* have unresolved symbols in this object because
I need to load it via dlopen().

Can anyone confirm this, please? Or maybe even show me what I've missed?
We haven't patched our compiler since February 2000 and I know that
there has been a new compiler patch released in the last month, so if
anyone who *has* installed the patch can confirm / refute this problem
then that would be useful too.

Cheers,
Chris

2. SCSI Zip for linux

3. Inline functions not implemented Sun C++ Workshop 5.0?

4. A stupid German asks:

5. Sun WorkShop 5.0: multiply defined inline functions

6. ETA for distros to come with 2.4.X kernel

7. Realocation Error (Problems with shared Libraries and templates)

8. "Proxy Error" reported on upload using netscape

9. Shared Libraries and C++ templates

10. AIX 5.1 VACPP 5.0.2.0 auto template instantiation and shared (-G) libraries

11. Template instantiation in a shared library

12. Building shared libraries for templates in Solaris

13. How to use C++ Standard Library with compat=4 in CC version 5.0