Bug 228727 - lang/ghc cannot be used as a bootstrap compiler
Summary: lang/ghc cannot be used as a bootstrap compiler
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-haskell (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-03 18:07 UTC by raichoo
Modified: 2019-07-07 11:39 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (haskell)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description raichoo 2018-06-03 18:07:44 UTC
The package for ghc version 8.4.2 has been built with dtrace support, sadly this results in a GHC that cannot be used to bootstrap another compiler. For that reason 8.4.2 should be build with the `--disable-dtrace` configure flag which was introduced as a workaround in 8.4.2. (see https://ghc.haskell.org/trac/ghc/ticket/15040).

I currently have a patch in review that hopefully fixes this issue altogether.
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2018-06-03 18:13:21 UTC
We are already using lang/ghc as a bootstrap compiler and building it with --enable-dtrace=0 on FreeBSD 10 and 11. What's not working for you?
Comment 2 raichoo 2018-06-03 20:21:29 UTC
I've checked the way ghc 8.4.2 was linked on CURRENT and it is just the way that causes the bootstrapping issues.

When trying to build 8.4.3 with the 8.4.2 shipped with pkg I get the following error.

/usr/bin/ld: error: duplicate symbol: StackOverflowHook
>>> defined at hschooks.c
>>>            ghc/stage1/build/hschooks.o:(StackOverflowHook)
>>> defined at OSMem.c
>>>            RTS.o:(.text.StackOverflowHook+0x0) in archive /usr/local/lib/ghc-8.4.2/rts/libHSrts.a

This happens because of the way the libHSrts.a (etc) has been linked and I'm the one to blame for this since I introduced that issue in GHC. As I said, a fix for this is under way.

This is probably affecting other people as well (I just got notified by someone else having similar issues).

You can check if the RTS is build the working way by checking it with `nm` like so:

nm libHSrts.a

If the archive only contains one object file (e.g. RTS.o) that build won't for building other ghcs.
Comment 3 Gleb Popov freebsd_committer freebsd_triage 2018-06-04 09:43:39 UTC
Aha, I was able to reproduce the issue. So, what do you propose? Setting enable-dtrace=0 unconditionally for all FreeBSD versions?
Comment 4 raichoo 2018-06-04 09:51:16 UTC
Right now that's probably the safest bet. 8.4.1 just introduced DTrace support and it caused these issues, so it's not like people are losing something that they expect to work, DTrace probes on FreeBSD Haskell is a fairly new thing. As I mentioned before: I currently have a patch in review that fixes this. One option would be to backport the patch once it has been accepted (It's really just a couple of changes in the rts makefile). But to be really safe turning it off for the binary shipped with pkg currently sounds like the best idea (I for one depend on that to work for bootstrapping quite a lot). I'll test drive the patch for a couple of months to see if it causes any further issues. If everything works out as expected it'll be safe to turn on dtrace support in 8.6.1 or even within the 8.4 line.
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-06-04 11:03:55 UTC
A commit references this bug:

Author: arrowd
Date: Mon Jun  4 11:03:02 UTC 2018
New revision: 471538
URL: https://svnweb.freebsd.org/changeset/ports/471538

Log:
  lang/ghc: Turn off DTrace support as it breaks building with BOOT option when installed ghc also came from ports.

  PR:		228727
  Reported by:	raichoo <raichoo@googlemail.com>
  Approved by:	tcberner (mentor)

Changes:
  head/lang/ghc/Makefile
Comment 6 Gleb Popov freebsd_committer freebsd_triage 2018-06-04 11:05:19 UTC
Thanks for your report and work!
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-07-07 11:39:52 UTC
A commit references this bug:

Author: arrowd
Date: Sun Jul  7 11:39:19 UTC 2019
New revision: 506132
URL: https://svnweb.freebsd.org/changeset/ports/506132

Log:
  lang/ghc: Remove `--enable-dtrace=0` for newer GHCs, seem to be working now.

  PR:		228727

Changes:
  head/lang/ghc/Makefile