Coping with a broken math lib ?

Anders F Björklund afb at algonet.se
Tue Feb 28 14:34:33 PST 2006


... or at least one that lacks several "long double"
functions, such as the one in Darwin 8.0.1 for x86:

http://www.opensource.apple.com/darwinsource/10.4/Libm-92/

It's OK for "powerpc", but the "i386" version wasn't up
to speed - so you got linker errors for missing symbols...

http://www.algonet.se/~afb/d/gdc-darwin8-x86-errors.txt

In other words, it's just like it says in std.c.math module:
     private import gcc.config;
     // unfortunately, these do not always exist in a library


It's been "fixed" in a newer version of Libm (in Darwin 8.4+),
but it would be "nice" if GDC could detect the missing ones ?

Perhaps fall back to using a "double" version, or other such
workaround ? The "real" type isn't 80 bits everywhere anyway.

I also fixed a ppc conditionalizing in the ldcompat part of it:
http://www.algonet.se/~afb/d/ldblcompat.d (a fix for i386/ppc64)


If you hack the references to all the missing math functions out,
*then* GDC works OK for Darwin 8 x86. Also works for Darwin 8 ppc.

But since Darwin 8.0.1 "ships" with gcc-4061 (i.e. gcc-4.0.0 based),
any 4.x based GDC needs to be built using: CC=gcc-3.3 CXX=g++-3.3

The same reason why gdcmac requires Xcode 2.2+, for Mac OS X 10.4...
(There won't be any Darwin binaries in the gdcmac project, just Mac)

--anders

PS.
Just wanted to know if it worked on "plain" Darwin too... It did. :-)



More information about the D.gnu mailing list