Gentoo Archives: gentoo-alt

From: Fabian Groffen <grobian@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] gcc-apple and C++ exceptions
Date: Thu, 27 May 2010 06:27:37
Message-Id: 20100527062650.GZ14641@gentoo.org
In Reply to: [gentoo-alt] gcc-apple and C++ exceptions by Matt Michalowski
1 On 27-05-2010 09:23:30 +1000, Matt Michalowski wrote:
2 > Hi all - first, a little test program, test.cpp:
3 [snip]
4 > When I compile this with my XCode g++ (gcc version 4.2.1 (Apple Inc.
5 > build 5659)) , it works as expected:
6 > $ /usr/bin/g++ -o test test.cpp
7 > $ otool -L ./test
8 > ./test:
9 > /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
10 > current version 7.9.0)
11 > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
12 > current version 125.0.1)
13 > $ ./test
14 > Caught runtime_error: runtime_error
15 >
16 > However, with my gentoo-alt gcc-apple g++ (gcc version 4.2.1 (Gentoo
17 > 4.2.1_p5659, Apple Inc. build 5659):
18 > $ g++ -o test test.cpp
19 > $ otool -L ./test
20 > ./test:
21 > /Users/mattm/gentoo/usr/lib/gcc/x86_64-apple-darwin10/4.2.1/libstdc++.6.dylib
22 > (compatibility version 7.0.0, current version 7.9.0)
23 > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
24 > current version 125.0.1)
25 > $ ./test
26 > terminate called after throwing an instance of 'std::runtime_error'
27 > Abort trap
28 >
29 > I've tried a few flags (-fexceptions, etc.), but I still can't get any
30 > C++ code compiled with the gentoo-alt gcc-apple to catch exceptions
31 > properly. Any ideas?
32
33 Compare the sizes of both programs. We noticed this problem a while
34 ago, because the linker (ld) is crashing on Snow Leopard when it tries
35 to issue an error (it throws it). I don't recall the exact details any
36 more, but for some reason if you do a static link, it does work. The
37 responsible objects seem to be not working when invoked dynamically or
38 something. heiko_ actually dived into it, but we were never able to
39 solve the problem. (And it doesn't show up on Tiger and Leopard.)
40
41
42 --
43 Fabian Groffen
44 Gentoo on a different level

Replies

Subject Author
Re: [gentoo-alt] gcc-apple and C++ exceptions Heiko Przybyl <zuxez@××××××××××××.de>