On Tue, Jan 10, 2006 at 10:11:04AM -0700, Martin Sebor wrote:
> Does this link with your gcc:
> 
> $ echo "int main (int argc, char**) { if (1 < argc) throw 0; }" \
>   > t.cpp && gcc t.cpp
> 
> If it does, all we should have to do to get it to work is drop
> -lsupc++ from the link line.
> 
> Otherwise, if you get output similar to mine (see below), we need
> to figure out the name of the C++ runtime library (not the gcc C++
> standard library, libstdc++) to link with (if there is one).
> 
> Undefined                       first referenced
>  symbol                             in file
> typeinfo for int                    /var/tmp//cccZUkS7.o
> __gxx_personality_v0                /var/tmp//cccZUkS7.o
> __cxa_throw                         /var/tmp//cccZUkS7.o
> __cxa_allocate_exception            /var/tmp//cccZUkS7.o
> ld: fatal: Symbol referencing errors. No output written to a.out
> collect2: ld returned 1 exit status

I get:

/usr/bin/ld: Undefined symbols:
typeinfo for int
___cxa_allocate_exception
___cxa_throw
___gxx_personality_v0
collect2: ld returned 1 exit status

> The unresolved symbols are defined in libsupc++.a in the stock gcc:
> 
> $   nm /usr/local/gcc-4.0.2/lib/libsupc++.a \
>   | egrep "__gxx_personality_v0|__cxa_throw|__cxa_allocate" \
>   | grep " T "
> 00000000 T __cxa_allocate_exception
> 00000000 T __gxx_personality_v0
> 00000000 T __cxa_throw

% nm /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libstdc++.dylib | egrep
  "__gxx_personality_v0|__cxa_throw|__cxa_allocate" | grep " T "
9550da34 T ___cxa_allocate_exception
9550ec80 T ___cxa_throw
9550e5d0 T ___gxx_personality_v0

So, does that mean Apple did something they shouldn't have done?

I will note that I have:

gcc version 4.0.0 (Apple Computer, Inc. build 5026)

The current version appears to be:

gcc version 4.0.1 (Apple Computer, Inc. build 5247)

4.0.1 produces the same error and has the same symbols in libstc++, FWIW.

> It's Andrew's old laptop :( We need to get a more recent OS X system
> for testing. Do you happen to know if Apple has some kind of a "test
> drive" program similar to HP's (http://www.testdrive.hp.com/)?

The ASF has access to a few Mac OS X machines running 10.4.  Send me your
ssh public key off-list and I can get you access.  -- justin

Reply via email to