Opened 7 years ago

Closed 7 years ago

#52582 closed defect (fixed)

ghc @7.8.3_4: RTS incompatibility with Sierra

Reported by: shanemikel Owned by: neverpanic (Clemens Lang)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: sierra haspatch Cc: bwesterb (Bas Westerbaan), favadi (Diep Pham), iqgrande, jsalort (Julien Salort), fpetzold, basmac, xrobin (Xavier Robin), lesinigo (Luca Lesinigo), pichtj (Jonathan Picht), grimreaper (Eitan Adler), neilt (Neil Tiffin), miguelbarao (MB), anddam (Andrea D'Amore), josmithiii, markemer (Mark Anderson)
Port: ghc

Description

Looks like we have a problem with Sierra. GHC won't build, and it looks like a problem in the RTS that doesn't account for some symbol change in some OS time library...

I don't really know what's going on here, but I've found a few things that might help: https://mail.haskell.org/pipermail/ghc-devs/2016-July/012508.html

If you follow through that mailing list, you'll find what looks to me like a few proposed patches..

I've also attached my build logs.

Attachments (6)

install_ghc.log (2.5 MB) - added by shanemikel 7 years ago.
install_ghc_main.log (2.6 MB) - added by shanemikel 7 years ago.
patch-Fix-GetTime.c-on-Darwin-with-clock_gettime.diff (716 bytes) - added by shanemikel 7 years ago.
build.log (7.0 MB) - added by shanemikel 7 years ago.
ghc_main.log.zip (106.6 KB) - added by murrayE 7 years ago.
zipped main.log for ghc build failure under Sierra
Portfile.diff (810 bytes) - added by stevecheckoway (Stephen Checkoway) 7 years ago.
Trivial Portfile modification to use the patch.

Change History (39)

Changed 7 years ago by shanemikel

Attachment: install_ghc.log added

Changed 7 years ago by shanemikel

Attachment: install_ghc_main.log added

comment:1 Changed 7 years ago by shanemikel

The corresponding ticket in GHCs system: https://ghc.haskell.org/trac/ghc/ticket/12195

It looks like this patch was merged into GHC 8 sources, but I don't know if we want to push the port that far ahead. I've applied that patch to the current macports version, and I'm building it now. I'll post if it succeeds..

comment:2 Changed 7 years ago by shanemikel

I've rebuilt with the mentioned patch. I'm uploading the log as build.log, and the patch.

Last edited 7 years ago by shanemikel (previous) (diff)

Changed 7 years ago by shanemikel

Attachment: build.log added

comment:3 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: cal@… removed
Keywords: sierra haspatch added
Owner: changed from macports-tickets@… to cal@…
Priority: HighNormal
Summary: GHC RTS incompatibility with Sierraghc @7.8.3_4: RTS incompatibility with Sierra

comment:4 Changed 7 years ago by neverpanic (Clemens Lang)

Since upstream seems to have applied this to GHC 8.0, I think it's fine to backport. Thanks for the analysis, I'll include this in my patches.

comment:5 Changed 7 years ago by bwesterb (Bas Westerbaan)

Cc: bas@… added

Cc Me!

comment:6 Changed 7 years ago by favadi (Diep Pham)

Cc: mrfavadi@… added

Cc Me!

comment:7 Changed 7 years ago by iqgrande

Cc: iqgrande added

comment:8 in reply to:  4 Changed 7 years ago by favadi (Diep Pham)

Replying to neverpanic:

Since upstream seems to have applied this to GHC 8.0, I think it's fine to backport. Thanks for the analysis, I'll include this in my patches.

What else need to be done to fix ghc build on Sierra?

comment:9 Changed 7 years ago by jsalort (Julien Salort)

Cc: jsalort added

comment:10 Changed 7 years ago by shanemikel

we need https://github.com/haskell/cabal/commit/8cac8be30dd9a3f6fed82df77e3215c128be113e, which is now merged into Cabal v1.24.1.0 and https://ghc.haskell.org/trac/ghc/ticket/12479.

That issue is closed in the GHC Trac, with a merged patch, but it's a little odd as the patch doesn't look related to these issues at all. Whatever, if Simon Marlow says it's good, it's good.

Version 0, edited 7 years ago by shanemikel (next)

comment:11 Changed 7 years ago by murrayE

ghc still not compatible with macOS Sierra (10.12.1): configures but does not build.

Changed 7 years ago by murrayE

Attachment: ghc_main.log.zip added

zipped main.log for ghc build failure under Sierra

comment:12 in reply to:  11 Changed 7 years ago by shanemikel

Replying to murrayE:

ghc still not compatible with macOS Sierra (10.12.1): configures but does not build.

The particular RTS problem addressed by this issue has been fixed, so I think this should be closed. The rest of the problems are related to linking, so I think a new thread should be opened for "GHC linking problem on Sierra" or something like that. In any case, it does look like those issues have been fixed, but getting them into a build may be a little tricky. For one, we need to make sure to pick the correct revision for the GHC repo (which should be in the 8.0.2 branch, but I'm not sure yet), and also, the Cabal submodule has to include another revision. Again, I'm not sure if the GHC head has updated the submodule to include that patch yet, or not. Finally, having the right source is only half the problem, as GHC is self-hosting; that is, we need a working GHC to build GHC. I'm not sure the best way to go about this, but I would start with either using a (Stage-1 or Stage-2?) GHC from El Capitan, or trying to figure out cross-building on Linux. I may try the Linux route as I no longer have access to an El Capitan machine.

I haven't actually done this before, so it could take me a little time to figure it out. If you want to give it a go, you can find some information here: https://ghc.haskell.org/trac/ghc/wiki/Building. Specifically the page about cross-compiling mentions the possibility of cross-building (targeting a different OS, as opposed to a different architecture).

Last edited 7 years ago by shanemikel (previous) (diff)

comment:13 Changed 7 years ago by shanemikel

@neverpanic, would you like to close this?

comment:14 Changed 7 years ago by neverpanic (Clemens Lang)

Shouldn't this ticket track whether a fix was applied to the MacPorts port (which hasn't happened yet afaik), or am I misunderstanding things here?

comment:15 Changed 7 years ago by fpetzold

The original problem that ghc does not build on macOS Sierra is not solved, and until then I think this ticket should remain open.

comment:16 Changed 7 years ago by fpetzold

Cc: fpetzold added

comment:17 Changed 7 years ago by basmac

Cc: basmac added

comment:18 Changed 7 years ago by xrobin (Xavier Robin)

Cc: xrobin added

comment:19 Changed 7 years ago by lesinigo (Luca Lesinigo)

Cc: lesinigo added

Changed 7 years ago by stevecheckoway (Stephen Checkoway)

Attachment: Portfile.diff added

Trivial Portfile modification to use the patch.

comment:20 Changed 7 years ago by stevecheckoway (Stephen Checkoway)

After applying the GetTime.c patch, I can build and install ghc on macOS 10.12.1 (see the attached Portfile.diff for the trivial modifications that are all that were required). I'm not sure what the linking issues are since it linked just fine for me. It would be great if the patch could be committed.

My recommendation is to apply this patch and close the bug. Additional issues can be tracked with a separate bug if need be.

comment:21 Changed 7 years ago by jmalcaide (Jose M. Alcaide)

I can confirm that after applying the Portfile patch and adding the GetTime.c patch file, the ghc port builds, installs and works just fine on macOS Sierra. So I also suggest to apply the fixes and close the bug. Please notice that this bug also affects the ports dependent on ghc.

comment:22 Changed 7 years ago by pichtj (Jonathan Picht)

Cc: pichtj added

comment:23 Changed 7 years ago by grimreaper (Eitan Adler)

Cc: grimreaper added

comment:24 Changed 7 years ago by rbq

Could someone™ please provide noob-proof instructions on how to apply the patch?

comment:25 in reply to:  24 Changed 7 years ago by sunoterra (Michael Stilson)

Replying to rbq:

Could someone™ please provide noob-proof instructions on how to apply the patch?

v (edit)

wiki:howto/PatchLocal

it's pretty much that process, replace arb with ghc obviously, and do not use the "-devel" suffix in your naming.

instead of manually updating source, like in the example, just add this file: raw-attachment:patch-Fix-GetTime.c-on-Darwin-with-clock_gettime.diff to your patches (i.e. cp ~/Dowloads/patch-Fix-GetTime.c-on-Darwin-with-clock_gettime.diff $(port dir ghc)/files/ after the indexing of the local ports repo is done).

and patch your Portfile with: raw-attachment:Portfile.diff (cd $(port dir ghc) and patch -p0 < ~/Downloads/Portfile.diff)

clean and build to verify.

NB: upon successful build, if your are installing this as a dependency of another port, just re-run your command to install that port and let it finish installing ghc; otherwise, if you do install ghc before your requested port, then you can sudo port unsetrequested ghc after install.

Last edited 7 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:26 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: neilt added

Has duplicate #53185.

comment:27 Changed 7 years ago by kencu (Ken)

+1 for this fix working on Sierra

comment:28 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

comment:29 Changed 7 years ago by miguelbarao (MB)

Cc: miguelbarao added

comment:30 Changed 7 years ago by anddam (Andrea D'Amore)

Cc: anddam added

comment:31 Changed 7 years ago by josmithiii

Cc: josmithiii added

comment:32 Changed 7 years ago by markemer (Mark Anderson)

Cc: markemer added

comment:33 Changed 7 years ago by agraef (Albert Graef)

Resolution: fixed
Status: newclosed

In d7385a7/macports-ports:

Fix broken ghc port, and add a patch to make it work on Sierra.

See: #52424
Closes: #52582

Note: See TracTickets for help on using tickets.