Re: compile C++ code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux