* compile C++ code
@ 2001-08-31 10:01 kjlin
2001-08-31 10:01 ` kjlin
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: kjlin @ 2001-08-31 10:01 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]
Hi all,
My host is x86 with redhat 7.0 and install the mips cross-compiler:
1.binutils-mips-linux-2.8.1-2.i386.rpm
2.egcs-mips-linux-1.1.2-3.i386.rpm
3.egcs-c++-mips-linux-1.1.2-4.i386.rpm
4.libc-2.0.6
5.egcs-libstdc++-mips-linux-2.9.0-4.i386.rpm
But when i compile the following C++ code, something wrong!
#include <stdio.h>
class A {
public:
A();
virtual void hello(); // with virtual is failed, without virtual is ok.
};
A::A() {printf("A construction!\n");}
void A::hello() { printf("hello\n"); }
main()
{
A *exam;
exam->hello();
}
#mips-linux-gcc test.C
/usr/lib/gcc-lib/mips-linux/egcs-2.91.66/libgcc.a(frame.o): In function `decode_uleb128':
/usr/src/redhat/BUILD/egcs-1.1.2/target-mips-linux/gcc/../../gcc/frame.c(.data+0x0): undefined reference to `pthread_create'
/usr/mips-linux/bin/ld: bfd assertion fail ../../bfd/elf32-mips.c:5123
mips-linux-gcc: Internal compiler error: program ld got fatal signal 11
#mips-linux-g++ test.C
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_create'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_getspecific'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_once'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_key_create'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_setspecific'
If the "virtual" is not used, "virtual void hello();" to "void hello();", mips-linux-gcc compiling is fine but mips-linux-g++ compiling is still the same error.
What is going on?
Is it the problem of compiler or library?
How should i do?
Thanks in advance!
KJ
[-- Attachment #2: Type: text/html, Size: 2944 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* compile C++ code
2001-08-31 10:01 compile C++ code kjlin
@ 2001-08-31 10:01 ` kjlin
2001-08-31 11:13 ` H.Heinold
2001-08-31 18:38 ` Jean-Christophe ARNU
2 siblings, 0 replies; 7+ messages in thread
From: kjlin @ 2001-08-31 10:01 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]
Hi all,
My host is x86 with redhat 7.0 and install the mips cross-compiler:
1.binutils-mips-linux-2.8.1-2.i386.rpm
2.egcs-mips-linux-1.1.2-3.i386.rpm
3.egcs-c++-mips-linux-1.1.2-4.i386.rpm
4.libc-2.0.6
5.egcs-libstdc++-mips-linux-2.9.0-4.i386.rpm
But when i compile the following C++ code, something wrong!
#include <stdio.h>
class A {
public:
A();
virtual void hello(); // with virtual is failed, without virtual is ok.
};
A::A() {printf("A construction!\n");}
void A::hello() { printf("hello\n"); }
main()
{
A *exam;
exam->hello();
}
#mips-linux-gcc test.C
/usr/lib/gcc-lib/mips-linux/egcs-2.91.66/libgcc.a(frame.o): In function `decode_uleb128':
/usr/src/redhat/BUILD/egcs-1.1.2/target-mips-linux/gcc/../../gcc/frame.c(.data+0x0): undefined reference to `pthread_create'
/usr/mips-linux/bin/ld: bfd assertion fail ../../bfd/elf32-mips.c:5123
mips-linux-gcc: Internal compiler error: program ld got fatal signal 11
#mips-linux-g++ test.C
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_create'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_getspecific'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_once'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_key_create'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_setspecific'
If the "virtual" is not used, "virtual void hello();" to "void hello();", mips-linux-gcc compiling is fine but mips-linux-g++ compiling is still the same error.
What is going on?
Is it the problem of compiler or library?
How should i do?
Thanks in advance!
KJ
[-- Attachment #2: Type: text/html, Size: 2944 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile C++ code
2001-08-31 10:01 compile C++ code kjlin
2001-08-31 10:01 ` kjlin
@ 2001-08-31 11:13 ` H.Heinold
2001-08-31 18:38 ` Jean-Christophe ARNU
2 siblings, 0 replies; 7+ messages in thread
From: H.Heinold @ 2001-08-31 11:13 UTC (permalink / raw)
To: linux-mips
On Fri, Aug 31, 2001 at 06:01:51PM +0800, kjlin wrote:
> Hi all,
>
> My host is x86 with redhat 7.0 and install the mips cross-compiler:
> 1.binutils-mips-linux-2.8.1-2.i386.rpm
> 2.egcs-mips-linux-1.1.2-3.i386.rpm
> 3.egcs-c++-mips-linux-1.1.2-4.i386.rpm
> 4.libc-2.0.6
> 5.egcs-libstdc++-mips-linux-2.9.0-4.i386.rpm
> But when i compile the following C++ code, something wrong!
This packages are old und buggy.
Please look in the archive where you can download the new toolchains.
Henning Heinold
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile C++ code
2001-08-31 10:01 compile C++ code kjlin
2001-08-31 10:01 ` kjlin
2001-08-31 11:13 ` H.Heinold
@ 2001-08-31 18:38 ` Jean-Christophe ARNU
2001-09-03 1:33 ` kjlin
2 siblings, 1 reply; 7+ messages in thread
From: Jean-Christophe ARNU @ 2001-08-31 18:38 UTC (permalink / raw)
To: kjlin; +Cc: linux-mips
On 31 Aug 2001 18:01:51 +0800, kjlin wrote:
> #mips-linux-gcc test.C
> /usr/lib/gcc-lib/mips-linux/egcs-2.91.66/libgcc.a(frame.o): In function `decode_uleb128':
> /usr/src/redhat/BUILD/egcs-1.1.2/target-mips-linux/gcc/../../gcc/frame.c(.data+0x0): undefined reference to `pthread_create'
> /usr/mips-linux/bin/ld: bfd assertion fail ../../bfd/elf32-mips.c:5123
> mips-linux-gcc: Internal compiler error: program ld got fatal signal 11
> #mips-linux-g++ test.C
> /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_create'
> /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_getspecific'
> /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_once'
> /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_key_create'
> /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_setspecific'
>
It seems you should link with pthread lib :
#mips-linux-g++ test.C -lpthread
I think the libgcc.a should be linked with it ... Can anyone tell us
further on that subject?
--
Jean-Christophe ARNU
s/w developer
Paratronic France
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile C++ code
2001-08-31 18:38 ` Jean-Christophe ARNU
@ 2001-09-03 1:33 ` kjlin
2001-09-03 1:33 ` kjlin
2001-09-03 6:21 ` Brian Murphy
0 siblings, 2 replies; 7+ messages in thread
From: kjlin @ 2001-09-03 1:33 UTC (permalink / raw)
To: linux-mips
> > #mips-linux-gcc test.C
> > /usr/lib/gcc-lib/mips-linux/egcs-2.91.66/libgcc.a(frame.o): In function
`decode_uleb128':
> >
/usr/src/redhat/BUILD/egcs-1.1.2/target-mips-linux/gcc/../../gcc/frame.c(.da
ta+0x0): undefined reference to `pthread_create'
> > /usr/mips-linux/bin/ld: bfd assertion fail ../../bfd/elf32-mips.c:5123
> > mips-linux-gcc: Internal compiler error: program ld got fatal signal 11
> > #mips-linux-g++ test.C
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_create'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_getspecific'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_once'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_key_create'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_setspecific'
> >
> It seems you should link with pthread lib :
> #mips-linux-g++ test.C -lpthread
>
> I think the libgcc.a should be linked with it ... Can anyone tell us
> further on that subject?
Yes, if i link with "-lpthread" , the error is solved.
But i am confused that when i compile the same code with native gcc/g++, it
is needless to link with that option.
Why?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile C++ code
2001-09-03 1:33 ` kjlin
@ 2001-09-03 1:33 ` kjlin
2001-09-03 6:21 ` Brian Murphy
1 sibling, 0 replies; 7+ messages in thread
From: kjlin @ 2001-09-03 1:33 UTC (permalink / raw)
To: linux-mips
> > #mips-linux-gcc test.C
> > /usr/lib/gcc-lib/mips-linux/egcs-2.91.66/libgcc.a(frame.o): In function
`decode_uleb128':
> >
/usr/src/redhat/BUILD/egcs-1.1.2/target-mips-linux/gcc/../../gcc/frame.c(.da
ta+0x0): undefined reference to `pthread_create'
> > /usr/mips-linux/bin/ld: bfd assertion fail ../../bfd/elf32-mips.c:5123
> > mips-linux-gcc: Internal compiler error: program ld got fatal signal 11
> > #mips-linux-g++ test.C
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_create'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_getspecific'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_once'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_key_create'
> > /usr/mips-linux/lib/libstdc++.so: undefined reference to
`pthread_setspecific'
> >
> It seems you should link with pthread lib :
> #mips-linux-g++ test.C -lpthread
>
> I think the libgcc.a should be linked with it ... Can anyone tell us
> further on that subject?
Yes, if i link with "-lpthread" , the error is solved.
But i am confused that when i compile the same code with native gcc/g++, it
is needless to link with that option.
Why?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile C++ code
2001-09-03 1:33 ` kjlin
2001-09-03 1:33 ` kjlin
@ 2001-09-03 6:21 ` Brian Murphy
1 sibling, 0 replies; 7+ messages in thread
From: Brian Murphy @ 2001-09-03 6:21 UTC (permalink / raw)
Cc: linux-mips
kjlin wrote:
> > > #mips-linux-gcc test.C
> > > /usr/lib/gcc-lib/mips-linux/egcs-2.91.66/libgcc.a(frame.o): In function
> `decode_uleb128':
> > >
> /usr/src/redhat/BUILD/egcs-1.1.2/target-mips-linux/gcc/../../gcc/frame.c(.da
> ta+0x0): undefined reference to `pthread_create'
> > > /usr/mips-linux/bin/ld: bfd assertion fail ../../bfd/elf32-mips.c:5123
> > > mips-linux-gcc: Internal compiler error: program ld got fatal signal 11
> > > #mips-linux-g++ test.C
> > > /usr/mips-linux/lib/libstdc++.so: undefined reference to
> `pthread_create'
> > > /usr/mips-linux/lib/libstdc++.so: undefined reference to
> `pthread_getspecific'
> > > /usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_once'
> > > /usr/mips-linux/lib/libstdc++.so: undefined reference to
> `pthread_key_create'
> > > /usr/mips-linux/lib/libstdc++.so: undefined reference to
> `pthread_setspecific'
> > >
> > It seems you should link with pthread lib :
> > #mips-linux-g++ test.C -lpthread
> >
> > I think the libgcc.a should be linked with it ... Can anyone tell us
> > further on that subject?
>
> Yes, if i link with "-lpthread" , the error is solved.
> But i am confused that when i compile the same code with native gcc/g++, it
> is needless to link with that option.
> Why?
The problem is that your old toolchain (ld) cannot handle weak symbols.
/Brian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-09-03 6:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-31 10:01 compile C++ code kjlin
2001-08-31 10:01 ` kjlin
2001-08-31 11:13 ` H.Heinold
2001-08-31 18:38 ` Jean-Christophe ARNU
2001-09-03 1:33 ` kjlin
2001-09-03 1:33 ` kjlin
2001-09-03 6:21 ` Brian Murphy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox