Subject: Re: .cpp compile problem with July 15 -current snapshot
To: Laine Stump <lainestump@speakeasy.net>
From: James Chacon <jmc@NetBSD.org>
List: current-users
Date: 07/21/2004 13:55:41
On Wed, Jul 21, 2004 at 02:01:43PM -0400, Laine Stump wrote:
> At 01:10 PM 7/21/2004, James Chacon wrote:
> >On Wed, Jul 21, 2004 at 09:57:33AM -0400, Laine Stump wrote:
> >> I just did a full install of the July 15 i386 snapshot from releng. When
> >I
> >> attempt to compile a simple .cpp program, I get the following link error:
> >>
> >> /var/tmp//ccMA9oBs.o(.eh_frame+0x11): undefined reference to
> >> `__gxx_personality_v0'
> >
> >How are you compiling the program? i.e. using g++ ?
>
> Thanks for the response!
>
> I *was* using "gcc file.cpp" as I've done for years for C++ and C source,
> but after seeing your message, I tried using g++ instead, and it linked
> okay. Is this some sort of GCC 2.9x vs 3.X thing? I've always relied on gcc
> to properly determine what to do based on file extension. Is it not
> supposed to do that any more, or is this breakage?
The various front ends (gcc, g++, g77, etc) all add the appropriate language
specific libraries to the link line for you. I beleive there are options to
gcc to also do that, but simply depening on file extension won't do it
(especially w. C++ and everything basically needing libstc++ now)
James
>
> -v shows the only difference to be during the ld step (as you'd expect).
> Here's the g++ (working) version:
>
> ld -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so
> /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o \
> -L/usr/bin/../libexec /var/tmp//ccKnyxsd.o -lstdc++ -lm -lgcc_s -lgcc -lc
> -lgcc_s -lgcc \
> /usr/lib/crtend.o /usr/lib/crtn.o
>
> and here's the gcc (non-working) version:
>
> ld -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so
> /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o \
> -L/usr/bin/../libexec /var/tmp//ccOxeMXe.o -lgcc -lgcc_eh -lc -lgcc
> -lgcc_eh /usr/lib/crtend.o /usr/lib/crtn.o
>
>