gmp.h needs to detect bit width more dynamically to support universal builds on mac
Dan Kegel
dank at kegel.com
Tue Dec 3 04:46:33 UTC 2013
gmp version: gmp-5.1.3
On Mac, preferred way to deliver libraries is as 'fat' libraries
containing both 32 and 64 bit code. This is easy to do with gmp,
just build gmp once for 32 bits and once for 64 bits, then combine
the libraries with the tool 'lipo'. So far, so good, no changes needed in gmp.
But there is a small problem: to support this scheme, the same gmp.h has to
be correct for use with both 32 and 64 bit code simultaneously.
That means that bit widths and the like must be computed using ifdef
when possible, and use the configure-generated values only as a fallback.
Examples of people doing this are legion, well, I found two easily:
https://gmplib.org/list-archives/gmp-discuss/2010-September/004312.html
https://github.com/openscad/openscad/blob/master/scripts/macosx-build-dependencies.sh
(And it seems people get it wrong sometimes:
https://github.com/openscad/openscad/issues/558 )
The fix is easy. Here's a patch that should Do The Right Thing, and
be completely safe for upstream:
http://kegel.com/gmp-universal-h.patch
Please have a look and let me know what you think.
Thanks,
Dan
More information about the gmp-bugs
mailing list