Building gmp 32-bit and 64-bit intel binary on Mac OS X 10.6.4

Elvis Dowson elvis.dowson at mac.com
Tue Sep 14 00:35:21 CEST 2010


Hi,
      There was a missing #endif in the modifications to the gmp.h file. Here is the correct code fragment.

Step 04: Modify the header file for 32-bit and 64-bit operation. 

$ mkdir -p install-universal/include
$ cp install-x86_64/include/gmp.h install-universal/include/gmp.h

Edit install-universal/include/gmp.h and modify it as follows:

#if defined(__i386__)
#define __GMP_HAVE_HOST_CPU_FAMILY_power   0
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
#define GMP_LIMB_BITS                      32
#define GMP_NAIL_BITS                      0
#elif defined(__x86_64__)
#define __GMP_HAVE_HOST_CPU_FAMILY_power   0
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
#define GMP_LIMB_BITS                      64
#define GMP_NAIL_BITS                      0
#elif defined(__ppc__)
#define __GMP_HAVE_HOST_CPU_FAMILY_power   0
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1
#define GMP_LIMB_BITS                      32
#define GMP_NAIL_BITS                      0
#elif defined(__powerpc64__)
#define __GMP_HAVE_HOST_CPU_FAMILY_power   0
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1
#define GMP_LIMB_BITS                      64
#define GMP_NAIL_BITS                      0
#else
#error Unsupported architecture
#endif
#endif

Step 05: Install the library.

$ sudo cp install-universal/lib/libgmp.10.dylib /usr/local/lib
$ sudo cp install-universal/lib/libgmp.a /usr/local/lib
$ sudo cp install-universal/lib/libgmp.la /usr/local/lib
$ cd /usr/local/lib
$ sudo ln -s libgmp.10.dylib libgmp.dylib

$ sudo cp install-universal/include/gmp.h /usr/local/include


Best regards,

Elvis Dowson


More information about the gmp-discuss mailing list