On 27-05-2010 09:23:30 +1000, Matt Michalowski wrote:
> Hi all - first, a little test program, test.cpp:
[snip] 
> When I compile this with my XCode g++ (gcc version 4.2.1 (Apple Inc.
> build 5659)) , it works as expected:
> $ /usr/bin/g++ -o test test.cpp
> $ otool -L ./test
> ./test:
>        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
> current version 7.9.0)
>        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 125.0.1)
> $ ./test
> Caught runtime_error: runtime_error
> 
> However, with my gentoo-alt gcc-apple g++ (gcc version 4.2.1 (Gentoo
> 4.2.1_p5659, Apple Inc. build 5659):
> $ g++ -o test test.cpp
> $ otool -L ./test
> ./test:
>        
> /Users/mattm/gentoo/usr/lib/gcc/x86_64-apple-darwin10/4.2.1/libstdc++.6.dylib
> (compatibility version 7.0.0, current version 7.9.0)
>        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 125.0.1)
> $ ./test
> terminate called after throwing an instance of 'std::runtime_error'
> Abort trap
> 
> I've tried a few flags (-fexceptions, etc.), but I still can't get any
> C++ code compiled with the gentoo-alt gcc-apple to catch exceptions
> properly. Any ideas?

Compare the sizes of both programs.  We noticed this problem a while
ago, because the linker (ld) is crashing on Snow Leopard when it tries
to issue an error (it throws it).  I don't recall the exact details any
more, but for some reason if you do a static link, it does work.  The
responsible objects seem to be not working when invoked dynamically or
something.  heiko_ actually dived into it, but we were never able to
solve the problem.  (And it doesn't show up on Tiger and Leopard.)


-- 
Fabian Groffen
Gentoo on a different level

Reply via email to