Ticket #31221 (new defect)
glib2 ppc64 build "cannot make union transparent"
|Reported by:||ccorn@…||Owned by:||ryandesign@…|
|Keywords:||ppc64 powerpc LP64 haspatch||Cc:||tascafoo@…|
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. 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.
- Cc ryandesign@… removed
- Owner changed from macports-tickets@… to ryandesign@…
- Keywords ppc64 powerpc LP64 haspatch added; universal, union, 64-bit removed
- Summary changed from glib2 +universal (ppc64 ppc) build "cannot make union transparent" to glib2 ppc64 build "cannot make union transparent"