[MacPorts] #31221: glib2 +universal (ppc64 ppc) build "cannot make union transparent"

MacPorts noreply at macports.org
Sun Sep 11 14:24:23 PDT 2011


#31221: glib2 +universal (ppc64 ppc) build "cannot make union transparent"
--------------------------------------+-------------------------------------
 Reporter:  ccorn@…                   |       Owner:  macports-tickets@…                   
     Type:  defect                    |      Status:  new                                  
 Priority:  Normal                    |   Milestone:                                       
Component:  ports                     |     Version:  2.0.3                                
 Keywords:  universal, union, 64-bit  |        Port:  glib2                                
--------------------------------------+-------------------------------------
 Platform: PowerMac G5 running MacOS X 10.5.8 (Darwin 9)

 Xcode version: 3.1.4 (providing gcc-4.0 and gcc-4.2, default is gcc-4.0)

 Port: glib2 @2.28.8_0+universal (SVN -r81247)

 universal_archs: ppc64 ppc

 Problem: Universal build with Xcode 3.1.4's gcc-4.0 or gcc-4.2 fails with
 warnings like
 {{{
 gobject/gboxed.c:120: warning: union cannot be made transparent
 }}}
 and subsequent errors due to function call signature mismatches.

 Using 64-bit only (-universal build_arch=ppc64) fails in the same manner.

 Using 32-bit only (-universal build_arch=ppc) works.

 Using configure.compiler=gcc-4.2 (default is gcc-4.0) does not make a
 difference.

 Apparent cause: Issues with (Apple Xcode 3.1.4's) GCC-4.0 and GCC-4.2 with
 regard to transparent unions (cf.
 [http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Type-Attributes.html#Type-
 Attributes GCC  type attributes]) containing 64-bit pointers.

 Proposed fix: The affected GCC versions should be fixed, and glib2 should
 probably adapt to the broken versions. Consequently, this is an upstream
 issue. However, for the time being, I propose a workaround for MacPorts
 using the attached patch.

 Explanation: The offending glib2 source code uses the function macro
 G_DEFINE_BOXED_TYPE which itself indirectly uses G_DEFINE_BOXED_TYPE_BEGIN
 in gobject/gtypes.h. Depending on the GCC version, glib2 selects one of
 two implementations of this macro. Recent GCC versions are made to use
 transparent unions. The {{{#else}}} implementation of
 G_DEFINE_BOXED_TYPE_BEGIN is portable.

 Patching gobject/gtypes.h to always use the portable implementation of
 G_DEFINE_BOXED_TYPE_BEGIN lets the universal build succeed. This is the
 workaround I propose.

-- 
Ticket URL: <https://trac.macports.org/ticket/31221>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list