After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 647145 - glib2 2.28.5 not compiling on Leopard ppc64
glib2 2.28.5 not compiling on Leopard ppc64
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
2.28.x
Other Mac OS
: Normal major
: ---
Assigned To: gtkdev
gtkdev
: 652912 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-04-08 08:37 UTC by crispy1975
Modified: 2013-09-19 12:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
glib2 debug build log (10.62 KB, application/x-bzip)
2011-04-08 08:37 UTC, crispy1975
  Details
Patch for gobject _G_DEFINE_BOXED_TYPE_BEGIN on ppc64 (902 bytes, patch)
2013-05-30 16:34 UTC, Misty De Meo
needs-work Details | Review
Patch to fix gobject compilation on OS X/ppc64 (1.26 KB, patch)
2013-09-19 06:45 UTC, Misty De Meo
committed Details | Review

Description crispy1975 2011-04-08 08:37:59 UTC
Created attachment 185500 [details]
glib2 debug build log

I am using MacPorts to try and install glib2 on a PowerPC Mac running OS X 10.5.8 (Leopard) with the arch set as ppc64. Kernel version is:

Darwin Power-Mac-G5.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh

I am also running XCode 3.1.4.

Debug build log attached.
Comment 1 Dan Winship 2011-04-08 10:49:25 UTC
oh, hey, a macppc compile problem that isn't my fault

it looks like the version of gcc you have doesn't support the anonymous union syntax used by G_DEFINE_BOXED_TYPE in gobject/gtype.h. This means that either (a) the gcc version checks in that macro are wrong, and we're trying to use an anonymous union on a version of gcc that doesn't actually support them, or (b) gcc on that version of mac os is broken, and does not support all the same features as the upstream version with the same number did.
Comment 2 crispy1975 2011-04-08 10:56:17 UTC
Ok, is there a test I can run to determine which of those possibilities might be true?
Comment 3 crispy1975 2011-04-11 10:27:27 UTC
At the moment the version of gcc installed is:

gcc --version
powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)

There would seem to be much later versions available in the MacPorts tree:

gcc40 @4.0.4 (lang)
gcc41 @4.1.2 (lang)
gcc42 @4.2.4 (lang)
gcc43 @4.3.5 (lang)
gcc44 @4.4.5 (lang)
gcc45 @4.5.2 (lang)

Would there be a version that is recommended to try and compile glib2 with other than the latest available. If not I'll try and get 4.5.x up and running and see how how goes.
Comment 4 John Ralls 2012-04-15 22:10:58 UTC
*** Bug 652912 has been marked as a duplicate of this bug. ***
Comment 5 Misty De Meo 2013-05-23 16:20:27 UTC
I can confirm that this is still an issue, as reported by a user of Tigerbrew here: https://github.com/mistydemeo/tigerbrew/issues/53

This issue occurs only when building for ppc64 (CFLAGS using `-arch ppc64` or `-mcpu=970 -m64`), with GCC 4.0.1 or 4.2. The same compilers can build glib correctly when building for 32-bit PPC arches.
Comment 6 Misty De Meo 2013-05-30 16:34:15 UTC
Created attachment 245663 [details] [review]
Patch for gobject _G_DEFINE_BOXED_TYPE_BEGIN on ppc64

It turns out that this issue is specifically an issue with 64-bit pointers in a transparent union on ppc64 in Apple's GCC; see Macports's ticket here: https://trac.macports.org/ticket/31221 No wonder tracking it down was tricky, given how highly specific it is.

I've attached a proposed patch. Currently untested, but it should work by making ppc64 builds fall down to the generic case. I'll let you know if I can get a G5 user to try it.
Comment 7 Dan Winship 2013-05-31 12:54:11 UTC
Comment on attachment 245663 [details] [review]
Patch for gobject _G_DEFINE_BOXED_TYPE_BEGIN on ppc64

>+#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) && !defined (__ppc64__))

that's not quite right; the "&& !defined (__ppc64__)" should go outside the GNUC version check. (As it is now, I assume it will generate a warning about mixing || and && without parentheses...)

But glib gets compiled on non-OS X ppc64 architectures too, so this needs to check the OS in addition to the architecture.

So

#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__WHATEVER_OS_X_DEFINES__) && defined (__ppc64__))

or so

Also, can you submit the patch in "git format-patch" format?
https://live.gnome.org/Git/Developers#Contributing_patches
Comment 8 Misty De Meo 2013-09-19 06:45:38 UTC
Created attachment 255271 [details] [review]
Patch to fix gobject compilation on OS X/ppc64

Sorry this fell off my radar. I've attached an amended patch via git format-patch.
Comment 9 Colin Walters 2013-09-19 12:41:44 UTC
It seems unlikely Apple's GCC will be fixed, so yeah, let's go with
this patch.

I also added a comment which links back to this bug.  "git blame"
tends to be hard to use for single lines.