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.
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?
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.
Aha, I was able to reproduce the issue. So, what do you propose? Setting enable-dtrace=0 unconditionally for all FreeBSD versions?
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.
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
Thanks for your report and work!
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