gmp-5.0.0 fails to build on x86_64-apple-darwin10

Jack Howarth howarth at bromo.med.uc.edu
Fri Jan 15 23:26:35 CET 2010


On Fri, Jan 15, 2010 at 06:49:34PM +0100, Torbjorn Granlund wrote:
> Jack Howarth <howarth at bromo.med.uc.edu> writes:
> 
>   Torbjörn,
>       I saw the duplicate symbol error as well on darwin9 with it's default
>   gcc-4.0 system compiler (but not when I used alternative gcc-4.2
>   and g++-4.2 system compilers). As I mentioned in...
>   
>   http://gmplib.org/list-archives/gmp-bugs/2010-January/001779.html
>   
>   I wonder if this is a side-effect of gcc-4.0 not understanding the
>   instances of __gnu_inline__? In any case, if gmp-5.0 required gcc-4.2,
>   this wouldn't be a first. The ppl package required for graphite support
>   in FSF gcc already requires gcc/g++-4.2.
> 
> Perhaps there is a way to define __GMP_EXTERN_INLINE that makes Apple
> gcc-4.0 behave like we want, i.e., inline or leave undefined?
> 
> -- 
> Torbjörn

Torbjörn,
   I see gmp.h has...

#ifdef __GNUC__
#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

It appears that this issue has been dealt with in the past...

http://www.mail-archive.com/bug-gnulib@gnu.org/msg09721.html

http://thread.gmane.org/gmane.network.gnutls.general/1061/focus=1136

Perhaps we need to use some variation of the proposed...

   /* Apple's gcc build >5400 (since Xcode 3.0) doesn't support GNU inline in C99 mode */
   #if __APPLE_CC__ > 5400 && !defined(C99_INLINE_SEMANTICS) && __STDC_VERSION__ >= 199901L
   #define C99_INLINE_SEMANTICS 1
   #endif

construction to avoid this issue on Apple's gcc 4.0. A quick test of the patch...

--- gmp-h.in.org	2010-01-15 13:59:34.000000000 -0500
+++ gmp-h.in	2010-01-15 14:01:07.000000000 -0500
@@ -421,7 +421,11 @@
     GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
     inline semantics, unless -fgnu89-inline is used.  */
 #ifdef __GNUC__
-#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
+/* Apple's gcc build >5400 (since Xcode 3.0) doesn't support GNU inline in C99 mode */
+#if __APPLE_CC__ > 5400 && !defined(C99_INLINE_SEMANTICS) && __STDC_VERSION__ >= 199901L
+#define C99_INLINE_SEMANTICS 1
+#endif
+#if ((defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)) && !(defined C99_INLINE_SEMANTICS)
 #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
 #else
 #define __GMP_EXTERN_INLINE      extern __inline__

shows that this eliminates the warnings on powerpc-apple-darwin9. We probably
need to improve that to avoid skipping __gnu_inline__ on the gcc-4.2 compiler.
I could probably bracket the test on __APPLE_CC__ to avoid  GNU inline for
Apple's gcc build >5400 but <5500. I beleve the builds of their gcc-4.2 are
all in the 55xx series. So maybe...

#if (__APPLE_CC__ > 5400) && (__APPLE_CC__ < 5500) && !defined(C99_INLINE_SEMANTICS) && __STDC_VERSION__ >= 199901L

                     Jack


More information about the gmp-bugs mailing list