macosx extern inline problem

Jay K jay.krell at
Tue May 25 00:21:03 CEST 2010

This is the default gcc with MacOSX 10.5/x86. I think it is worth trying a bit.
There is seemingly just one problem, here is a fix:

#ifdef __GNUC__
> /* Apple gcc 4.0.1 -std=gnu99 has problems, worked around here. */
> #if defined __GNUC_STDC_INLINE__ && defined __APPLE__ && __GNUC__ == 4 && __GNUC_MINOR__ == 0
> #define __GMP_EXTERN_INLINE      __inline__
> #else
#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
#define __GMP_EXTERN_INLINE      extern __inline__
> #endif

static inline would maybe work too. I can try that.


It sounds like if you kept everything in C and accepted the default PIC, many problems would go away?
"Keeping everything in C", the use of "none" above, is what the gcc build does when it builds gmp.

With the above patch, my script works:

#! /usr/bin/env bash

set -e
set -x

gmp_packages="gmp mpfr mpc"

# native gmp, mpfr, mpc

for T in $build; do
  for P in $gmp_packages; do
    mkdir -pv /obj/$P/$T
    cd /obj/$P/$T
    if [ -f Makefile ]; then :; else
      /src/`eval echo $P-\$\{${P}_VER\}`/configure \
        -host=none-none-none \
        -target=none-none-none \
        -disable-shared \
        -with-gmp=$HOME/$T \
        -with-mpfr=$HOME/$T \
        -with-mpc=$HOME/$T \
        -prefix=$HOME/$T \
    make -j8
    make install

 - Jay

> To: jay.krell at
> CC: gmp-discuss at
> Subject: Re: macosx extern inline problem
> From: tg at
> Date: Mon, 24 May 2010 18:29:41 +0200
> I am afraid I don't think supporting all Xcode versions in GMP is
> viable.  Apple's quality control leaves a lot to be desired, and if we
> tried to implement workarounds for every Apple problem, then we would
> make GMP more complex and harder to maintain.
> Fortunately, several Xcode versions can be used for compiling GMP.
> See also for information about some Xcode
> quality problems.
> -- 
> Torbjörn

More information about the gmp-discuss mailing list