[MacPorts] #16634: __gnu_inline__ attribute directive and Apple's gcc
#16634: __gnu_inline__ attribute directive and Apple's gcc ---------------------------------+------------------------------------------ Reporter: jhr@cs.uchicago.edu | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: Port Bugs Component: ports | Version: 1.6.0 Keywords: gmp, inline | Port: gmp ---------------------------------+------------------------------------------ I am trying to build the MLton SML compiler (http://mlton.org), which uses the gmp library. When compiling the runtime system, linking is failing because of multiple definitions of some of the GMP symbols (such as {{{___gmpz_abs}}}). I've done some digging, and it seems that the source of the problem is related to a recent change in gmp.h and a bad interaction with Apple's version of gcc. Specifically, the {{{__gnu_inline__}}} attribute directive is causing problems (see http://www.mail-archive.com/bug-gnulib@gnu.org/msg09721.html for some discussion; a latter message in the thread proposes a patch). -- Ticket URL: <http://trac.macports.org/ticket/16634> MacPorts <http://www.macports.org/> Ports system for Mac OS
#16634: __gnu_inline__ attribute directive and Apple's gcc ----------------------------------+----------------------------------------- Reporter: jhr@cs.uchicago.edu | Owner: macports-tickets@lists.macosforge.org Type: defect | Status: new Priority: Normal | Milestone: Port Bugs Component: ports | Version: 1.6.0 Resolution: | Keywords: gmp, inline Port: gmp | ----------------------------------+----------------------------------------- Changes (by raimue@macports.org): * cc: raimue@macports.org (added) Comment: The best would be to retrieve the patch from upstream directly if we want to apply it to the current version and do not just wait for the next release. But I was unable to locate a source repository. I found the [http://thread.gmane.org/gmane.comp.lib.gmp.bugs/1979 patch submission to upstream], but I don't know if further action was taken. Will attach the patch from there to this ticket. -- Ticket URL: <http://trac.macports.org/ticket/16634#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#16634: __gnu_inline__ attribute directive and Apple's gcc ---------------------------------+------------------------------------------ Reporter: jhr@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Port Bugs Component: ports | Version: 1.6.0 Keywords: gmp, inline | Port: gmp ---------------------------------+------------------------------------------ Comment(by jhr@…): I just tried the most recent version of gmp from MacPorts (4.2.4) and the above patch does not work. The following patch fixes the problem for me (NEWgmp.h is the correct file). *** NEWgmp.h 2009-01-02 14:31:02.000000000 -0600 --- gmp.h 2009-01-01 13:58:09.000000000 -0600 *************** *** 421,433 **** GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. */ #ifdef __GNUC__ ! #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__)) ! #define __GMP_INLINE_PROTOTYPES 1 ! #elif !(defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && __STDC_VERSION__ >= 199901L) #define __GMP_EXTERN_INLINE extern __inline__ - #define __GMP_INLINE_PROTOTYPES 1 #endif #endif /* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1 --- 421,432 ---- 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) #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__)) ! #else #define __GMP_EXTERN_INLINE extern __inline__ #endif + #define __GMP_INLINE_PROTOTYPES 1 #endif /* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1 -- Ticket URL: <http://trac.macports.org/ticket/16634#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#16634: __gnu_inline__ attribute directive and Apple's gcc ---------------------------------+------------------------------------------ Reporter: jhr@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Port Bugs Component: ports | Version: 1.6.0 Keywords: gmp, inline | Port: gmp ---------------------------------+------------------------------------------ Comment(by jhr@…): Let's try that again with correct formatting: {{{ *** NEWgmp.h 2009-01-02 14:31:02.000000000 -0600 --- gmp.h 2009-01-01 13:58:09.000000000 -0600 *************** *** 421,433 **** GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. */ #ifdef __GNUC__ ! #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__)) ! #define __GMP_INLINE_PROTOTYPES 1 ! #elif !(defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && __STDC_VERSION__ >= 199901L) #define __GMP_EXTERN_INLINE extern __inline__ - #define __GMP_INLINE_PROTOTYPES 1 #endif #endif /* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1 --- 421,432 ---- 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) #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__)) ! #else #define __GMP_EXTERN_INLINE extern __inline__ #endif + #define __GMP_INLINE_PROTOTYPES 1 #endif /* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1 }}} -- Ticket URL: <http://trac.macports.org/ticket/16634#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#16634: __gnu_inline__ attribute directive and Apple's gcc ---------------------------------+------------------------------------------ Reporter: jhr@… | Owner: mcalhoun@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.6.0 Keywords: gmp, inline | Port: gmp ---------------------------------+------------------------------------------ Changes (by raimue@…): * owner: macports-tickets@… => mcalhoun@… -- Ticket URL: <http://trac.macports.org/ticket/16634#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
#16634: __gnu_inline__ attribute directive and Apple's gcc ----------------------------------+----------------------------------------- Reporter: jhr@… | Owner: mcalhoun@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 1.6.0 Resolution: fixed | Keywords: gmp, inline Port: gmp | ----------------------------------+----------------------------------------- Changes (by mcalhoun@…): * status: new => closed * resolution: => fixed Comment: Just to summarize the situation: * The C99 and GNU extension "extern inline" are [http://www.greenend.org.uk/rjk/2003/03/inline.html different]. * gmp.h requires GNU extension behavior. * When in C99 mode is set with -std, gmp.h tries to force GNU extension inline behavior using "!__attribute!__ ((!__gnu_inline!__))". Problems: * In C99 mode, there does not seem to be a way to force the Apple GCC 4.0 to use GNU inline behavior. * In some older Apple GCC versions, !__GNUC_STDC_INLINE!__ was not defined even in C99 mode. Possible Solutions: * Turn off inlining when using Apple GCC version 4.0 in C99 mode. * Patch gmp.h to work with C99 inline behavior. The first options is the easiest and was incorporated in r50566. -- Ticket URL: <http://trac.macports.org/ticket/16634#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts