macosx extern inline problem

Jay K jay.krell at cornell.edu
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:

gmp-h.in:

#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__
> #define __GMP_INLINE_PROTOTYPES  0
> #else
#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
#else
#define __GMP_EXTERN_INLINE      extern __inline__
#endif
#define __GMP_INLINE_PROTOTYPES  1
#endif
> #endif

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

 > http://gmplib.org/macos.html

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_VER=4.3.2
mpfr_VER=2.4.2
mpc_VER=0.8.1
build=i686-darwin
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 \
        -verbose
    fi
    make -j8
    make install
  done
done


Thanks,
 - Jay


> To: jay.krell at cornell.edu
> CC: gmp-discuss at gmplib.org
> Subject: Re: macosx extern inline problem
> From: tg at gmplib.org
> 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 http://gmplib.org/macos.html for information about some Xcode
> quality problems.
> 
> -- 
> Torbjörn
 		 	   		  


More information about the gmp-discuss mailing list