public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC 2.95.1 static string won't compile on SCO-OSR5
@ 1999-09-08 23:27 + +
  1999-09-09  8:12 ` Robert Lipe
  1999-09-30 18:02 ` + +
  0 siblings, 2 replies; 8+ messages in thread
From: + + @ 1999-09-08 23:27 UTC (permalink / raw)
  To: egcs

Hellow,

I'm trying to compile the following example: 

----------
#include <string>

class ctest
{
public:
        static string   foo;
};

string  ctest::foo;

void main()
{
        ctest::foo = "bar";
}
----------

Which is no problem using EGCS 1.1.1 on the same machine. GCC 2.95.1 won't
do it however:

----------
[ildev2] /usr/rob> /usr/local/gcc-2.95.1/bin/g++ test.cc
/usr/local/gcc-2.95.1/lib/gcc-lib/i586-pc-
sco3.2v5.0.0/2.95.1/libstdc++.a(cstrmain.o): fatal error: symbol `__as__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_tem
plate2b0i0PCc` multiply-defined, also in file /usr/tmp/cc4lMcjd.o
collect2: ld returned 1 exit status [ildev2] /usr/rob> ----------

I can't make any sense of this error... Does this mean my GCC install is broken (again), or is this invalid C++?

Thanks!

 Rob Kramer
 robk@cyberway.com.sg




--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GCC 2.95.1 static string won't compile on SCO-OSR5
  1999-09-08 23:27 GCC 2.95.1 static string won't compile on SCO-OSR5 + +
@ 1999-09-09  8:12 ` Robert Lipe
  1999-09-30 18:02   ` Robert Lipe
  1999-09-30 18:02 ` + +
  1 sibling, 1 reply; 8+ messages in thread
From: Robert Lipe @ 1999-09-09  8:12 UTC (permalink / raw)
  To: + +; +Cc: egcs

This is a known (sigh) problem with current g++ and essentially all
the System V linkers.  THey differ in their interpretation of .weak.
The solution on most systems is to use GNU ld.  Unfortunately, GNU ld
doesn't support OSR5 well enough to be an acceptable substutute.

But the good news is that other than templates, things work OK. :-(

RJL


> Which is no problem using EGCS 1.1.1 on the same machine. GCC 2.95.1 won't
> do it however:
> 
> ----------
> [ildev2] /usr/rob> /usr/local/gcc-2.95.1/bin/g++ test.cc
> /usr/local/gcc-2.95.1/lib/gcc-lib/i586-pc-
> sco3.2v5.0.0/2.95.1/libstdc++.a(cstrmain.o): fatal error: symbol `__as__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_tem
> plate2b0i0PCc` multiply-defined, also in file /usr/tmp/cc4lMcjd.o
> collect2: ld returned 1 exit status [ildev2] /usr/rob> ----------

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GCC 2.95.1 static string won't compile on SCO-OSR5
  1999-09-09  8:12 ` Robert Lipe
@ 1999-09-30 18:02   ` Robert Lipe
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Lipe @ 1999-09-30 18:02 UTC (permalink / raw)
  To: + +; +Cc: egcs

This is a known (sigh) problem with current g++ and essentially all
the System V linkers.  THey differ in their interpretation of .weak.
The solution on most systems is to use GNU ld.  Unfortunately, GNU ld
doesn't support OSR5 well enough to be an acceptable substutute.

But the good news is that other than templates, things work OK. :-(

RJL


> Which is no problem using EGCS 1.1.1 on the same machine. GCC 2.95.1 won't
> do it however:
> 
> ----------
> [ildev2] /usr/rob> /usr/local/gcc-2.95.1/bin/g++ test.cc
> /usr/local/gcc-2.95.1/lib/gcc-lib/i586-pc-
> sco3.2v5.0.0/2.95.1/libstdc++.a(cstrmain.o): fatal error: symbol `__as__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_tem
> plate2b0i0PCc` multiply-defined, also in file /usr/tmp/cc4lMcjd.o
> collect2: ld returned 1 exit status [ildev2] /usr/rob> ----------

^ permalink raw reply	[flat|nested] 8+ messages in thread

* GCC 2.95.1 static string won't compile on SCO-OSR5
  1999-09-08 23:27 GCC 2.95.1 static string won't compile on SCO-OSR5 + +
  1999-09-09  8:12 ` Robert Lipe
@ 1999-09-30 18:02 ` + +
  1 sibling, 0 replies; 8+ messages in thread
From: + + @ 1999-09-30 18:02 UTC (permalink / raw)
  To: egcs

Hellow,

I'm trying to compile the following example: 

----------
#include <string>

class ctest
{
public:
        static string   foo;
};

string  ctest::foo;

void main()
{
        ctest::foo = "bar";
}
----------

Which is no problem using EGCS 1.1.1 on the same machine. GCC 2.95.1 won't
do it however:

----------
[ildev2] /usr/rob> /usr/local/gcc-2.95.1/bin/g++ test.cc
/usr/local/gcc-2.95.1/lib/gcc-lib/i586-pc-
sco3.2v5.0.0/2.95.1/libstdc++.a(cstrmain.o): fatal error: symbol `__as__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_tem
plate2b0i0PCc` multiply-defined, also in file /usr/tmp/cc4lMcjd.o
collect2: ld returned 1 exit status [ildev2] /usr/rob> ----------

I can't make any sense of this error... Does this mean my GCC install is broken (again), or is this invalid C++?

Thanks!

 Rob Kramer
 robk@cyberway.com.sg




--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GCC 2.95.1 static string won't compile on SCO-OSR5
  1999-09-09 19:48 + +
  1999-09-10 22:08 ` Robert Lipe
@ 1999-09-30 18:02 ` + +
  1 sibling, 0 replies; 8+ messages in thread
From: + + @ 1999-09-30 18:02 UTC (permalink / raw)
  To: Robert Lipe; +Cc: egcs

>This is a known (sigh) problem with current g++ and 
>essentially all the System V linkers.  

>But the good news is that other than templates, things 
>work OK. :-(

Hmm. Oh well, at least if I know it won't work, I can work around it. But could you tell me what exactly I can't do? A static 'list <int>' or whatever seems to work fine. What's special about a string?

Thanks!

    Rob Kramer
    robk@cyberway.com.sg



--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GCC 2.95.1 static string won't compile on SCO-OSR5
  1999-09-10 22:08 ` Robert Lipe
@ 1999-09-30 18:02   ` Robert Lipe
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Lipe @ 1999-09-30 18:02 UTC (permalink / raw)
  To: + +; +Cc: egcs

> >This is a known (sigh) problem with current g++ and essentially all  
> >the System V linkers.                                                
>
> >But the good news is that other than templates, things work OK. :-(
>
> Hmm. Oh well, at least if I know it won't work, I can work around it.
> But could you tell me what exactly I can't do? A static 'list <int>'
> or whatever seems to work fine. What's special about a string?

I can't tell you at a C++ level (I speak only kindergarten C++) exactly
what triggers this though it seems to be template related. At the linker
level, the conflict is that the System V linkers don't allow a strong
definition to follow a weak definition of a symbol in archives and the
G++ template logic depends on the GNU ld behaviour of allowing this.

There are threads in the archives describing this in painful detail.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GCC 2.95.1 static string won't compile on SCO-OSR5
  1999-09-09 19:48 + +
@ 1999-09-10 22:08 ` Robert Lipe
  1999-09-30 18:02   ` Robert Lipe
  1999-09-30 18:02 ` + +
  1 sibling, 1 reply; 8+ messages in thread
From: Robert Lipe @ 1999-09-10 22:08 UTC (permalink / raw)
  To: + +; +Cc: egcs

> >This is a known (sigh) problem with current g++ and essentially all  
> >the System V linkers.                                                
>
> >But the good news is that other than templates, things work OK. :-(
>
> Hmm. Oh well, at least if I know it won't work, I can work around it.
> But could you tell me what exactly I can't do? A static 'list <int>'
> or whatever seems to work fine. What's special about a string?

I can't tell you at a C++ level (I speak only kindergarten C++) exactly
what triggers this though it seems to be template related. At the linker
level, the conflict is that the System V linkers don't allow a strong
definition to follow a weak definition of a symbol in archives and the
G++ template logic depends on the GNU ld behaviour of allowing this.

There are threads in the archives describing this in painful detail.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GCC 2.95.1 static string won't compile on SCO-OSR5
@ 1999-09-09 19:48 + +
  1999-09-10 22:08 ` Robert Lipe
  1999-09-30 18:02 ` + +
  0 siblings, 2 replies; 8+ messages in thread
From: + + @ 1999-09-09 19:48 UTC (permalink / raw)
  To: Robert Lipe; +Cc: egcs

>This is a known (sigh) problem with current g++ and 
>essentially all the System V linkers.  

>But the good news is that other than templates, things 
>work OK. :-(

Hmm. Oh well, at least if I know it won't work, I can work around it. But could you tell me what exactly I can't do? A static 'list <int>' or whatever seems to work fine. What's special about a string?

Thanks!

    Rob Kramer
    robk@cyberway.com.sg



--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1999-09-30 18:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-08 23:27 GCC 2.95.1 static string won't compile on SCO-OSR5 + +
1999-09-09  8:12 ` Robert Lipe
1999-09-30 18:02   ` Robert Lipe
1999-09-30 18:02 ` + +
1999-09-09 19:48 + +
1999-09-10 22:08 ` Robert Lipe
1999-09-30 18:02   ` Robert Lipe
1999-09-30 18:02 ` + +

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).