OS X for PowerPC is not supported by Apple anymore. GHC's support has most likely bit-rotted and we have no test machine. Let's go ahead and remove support for PowerPC Darwin.
The following components contain PowerPC Darwin specific code:
native code generator
RTS
driver
build system
testsuite
Edited
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
What would it take to bring it back? I am not asking someone to do that for me, of course, I want to do it myself.
I have bootstrapped ghc 7.0.1 and used it to build ghc 7.6.3, however resulting compiler, while apparently functional, failed to build ghc 7.8.x and even to rebuild itself.
I describe the problem here: https://trac.macports.org/ticket/64698
To reintroduce PowerPC/Darwin support we would need someone to take ownership of the platform. This means they would need to work through a reversion of 374e4470, test it, and introduce some form of CI testing infrastructure so we can ensure that it doesn't break in the future. This could either be through the provision of hardware or testing via virtual-machine. Admittedly, I'm not a Mac user so I'm not sure whether the latter is feasible.
I can do the testing on my end, and see if reversion works. Before that I need to solve the current issue of building some later version of ghc (ghc-stage1: internal error: evacuate(static): strange closure type), I will work on that.
Do you know by chance which was the last version of ghc to support PPC in principle? (UPD. Apparently, PPC support was removed between 8.6.5 and 8.8.1.)
And if PPC support was removed at once (i.e. here) or in stages, this being the last clean-up?
P. S. The latest [semi-]official binaries for powerpc-apple-darwin existing are of 7.0.1 and 7.0.4. But I compared the PPC-relevant code which was removed in this commit, and it is present in similar form in 7.8.4, for instance, and even in 8.6.5. Moreover, it seemed to me that some parts could have been actually added at some point (I may be wrong here). There is a huge gap between the last ready-made compiler for PPC and a point when PPC support was removed from the code base. It looks somewhat surprising to me: it was maintained for quite a long time, but I could not find any actual builds for PPC.
@kencu Thank you for joining in. Yes, PPC interest is from my side, I did not imply that I act on behalf of Macports here. If I can fix ghc for PPC, we may probably commit that to Macports however. Provided you and other won’t object.
We still support PowerPC to this day. What was removed is PowerPC/Darwin support, as you say, around the 8.8 timeframe. I am honestly not really sure what state PowerPC/Darwin support was in at the time of its removal since at that point PowerPC-based Macs hadn't shipped for over a decade. It's quite possible that it was badly broken even then. I'm not a Mac user myself but I'm a tad surprised that there exists any software support for this configuration in 2022.
If Darwin PowerPC ghc works again someday, I certainly won't object to any inclusions into macports. I have pretty much kept powerpc macs going on Macports largely by myself the past 5 years ;> But I recognize the inherent issues involved in asking a large, active, current compiler chain to support such a niche, ancient, and unsupported by upstream target.
Actually I run PowerPC ghc on these PowerMacs now -- the linux version, under debian 11.
I indeed mentioned Ben as a knowledgable and helpful fellow that would likely be responsive to polite questions.
I was not aware that ghc had fully pulled Darwin PowerPC support, nor am I advocating for that to change.
We appreciate the current reach of ghc back to 10.7 for our older systems users, and we have locally built ghc versions available for 10.6.8 for the true archeologists.
@bgamari If you or someone could give me a quick advice on the error I’m facing, that would be very helpful.
I have tried building 7.7, 7.8.x and 7.10.3 (using 7.6.2 and 7.6.3), however I am stuck every time on the same failure: ghc-stage1: internal error: evacuate(static): strange closure type.
Initially I was getting it with building ghc-prim, then I tweaked settings in a variety of ways and the best I was able to get is building stage0 and stage1 completely and the same error happens when building items in libraries/base/GHC, specifically Float, but some other too.
I cannot figure out why this happens, and while I have found a similar error reported here, that was fixed in 7.10, but for me 7.10 still failed in identical way. Report here: #8976 (closed)
I literally spent hours on this, and I dunno what to try further.
@barracuda156 This error could be anything, it means that the state of the heap has got corrupted somehow so the RTS thinks it's looking at one closure type but actually it's either looking at random memory or a different closure type.
We don't really have any resources to help in a meaningful way but at least you can try linking with the debug RTS (-debug) and enabling the sanity checks -DS.
What surprised me was consistency: regardless of which compiler I used to start with (7.0.1 or 7.0.4), which proceeded with (7.6.2 or 7.6.3) and which tried to build (7.7, 7.8.4 or 7.10.3), it was always the same kind of failure – either on ghc-prim or float.
P. S. I tried also on 10.6.8 Rosetta, but that appears hopelessly broken:
When I started to work on PowerPC 64-bit for Linux many years ago there was one developer who still supported PowerPC 32-bit Linux and at some point I helped with a port to AIX, also 32-bit. I don't remember seeing neither comments nor patches referring to Darwin since I started my work on the PowerPC 64-bit native code generator.
There are several challenges with PowerPC on Darwin:
It is big-endian and that is not well tested (not at all in CI) and we have had several big-endian bugs and even some still in HEAD. See #16998.
PowerPC has weak memory consistency and there were also quite a few race conditions that might lead to the heap corruption. Though the consistency (determinism) in failures you report seems to suggest that is not the case in the crashes you observed.
While Linux has moved on Darwin had not been touched in many years until it was finally removed. If I remember correctly there was one other commit after 374e4470 that removed some Darwin material that I had missed.
I would not waste my time trying to fix old versions from the 7 series of GHC. Just cross-compile the GHC version that you want for MacPorts and then fix that version. To get many potential PowerPC issues out of the picture I recommend an unregisterised compiler first (configure --enable-unregisterised). Then you have a working compiler that you can use to resurrect native code support for Darwin. Commit 374e4470 can be a reference for what needs to be done, the files/modules, however, have been moved around since. Personally, I prefer to write this kind of code with the ABI specification at hand and I use tiny C programs compiled by GCC to confirm what I learned from the ABI specification. It also would not hurt to have the Darwin assembler manual handy.
I might be able to help with explaining how and where things are done in the PowerPC native code generator, but I don't know Darwin and thus can't be of much help with debugging. My PowerMac runs a 64-bit Linux distribution :-)
This ticket was about removing Darwin support and that has been done. So I would like to close this ticket again.
@trommler Thank you very much for reply! This is very informative. I will follow your suggestion and try to fix a recent version then.
Once I have some results, I will open a new ticket and hopefully you may give some further advice.
(Sorry for a delay, been occupied with other projects. I am committed to getting ghc fixed for PowerPC, it is just a matter of time.)