Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 843968 - dev-lang/ghc panic for dev-haskell/skylighting-core (ghc: panic! (the 'impossible' happened) (GHC version 9.0.2: ModOrigin: hidden module redefined))
Summary: dev-lang/ghc panic for dev-haskell/skylighting-core (ghc: panic! (the 'imposs...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-05-13 01:15 UTC by Zhichu Chen
Modified: 2023-03-26 08:07 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,9.88 KB, text/plain)
2022-05-13 01:15 UTC, Zhichu Chen
Details
build log (build.log,9.48 KB, text/x-log)
2022-05-13 01:16 UTC, Zhichu Chen
Details
build log hslua-classes-2.2.0:20220731-042419.log (hslua-classes-2.2.0:20220731-042419-build.log,7.41 KB, text/x-log)
2022-07-31 04:32 UTC, Khumba
Details
emerge --info hslua-classes (emerge-info-hslua-classes.txt,8.47 KB, text/plain)
2022-07-31 04:33 UTC, Khumba
Details
emerge --info (emerge-info.txt,11.00 KB, text/plain)
2023-03-24 16:49 UTC, Timo Ollech
Details
build log (build.log,9.95 KB, text/x-log)
2023-03-24 16:50 UTC, Timo Ollech
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zhichu Chen 2022-05-13 01:15:38 UTC
Created attachment 778406 [details]
emerge --info

The interesting part is:

```
Building library for skylighting-core-0.12.3..
ghc: panic! (the 'impossible' happened)
  (GHC version 9.0.2:
	ModOrigin: hidden module redefined

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
```




I think it's related to:
https://gitlab.haskell.org/ghc/ghc/-/issues/21097
Comment 1 Zhichu Chen 2022-05-13 01:16:50 UTC
Created attachment 778409 [details]
build log

Sorry, forgot the build log.
Comment 2 Zhichu Chen 2022-05-15 16:39:43 UTC
Well, since nobody else confirmed this, I tried to unmerge and re-emerge the packages rather than just run `haskell-update`. This time, I got everything compiled.
Comment 3 Klaus Ethgen 2022-07-17 12:23:05 UTC
I have the same troubles since some weeks. Lets say, the whole haskell stack is a mess leaving me with unbuildable git-annex but this is another problem.

This problem prevent a normal rebuild. I did not find any way to rebuild except of unmerging all haskell stack and remerged it. This is a big wast of recources.
Comment 4 Khumba 2022-07-20 23:32:17 UTC
Same here, I can't rebuild skylighting-core-0.12.3.  I'll keep my old build around for a bit in case there is any testing that can be done.
Comment 5 Zhichu Chen 2022-07-20 23:43:19 UTC
(In reply to Khumba from comment #4)
> Same here, I can't rebuild skylighting-core-0.12.3.  I'll keep my old build
> around for a bit in case there is any testing that can be done.

Just unmerge relevant packages and run haskell-updater. If that ends up error, do that again. Eventually, you'll get there. My record is 3 times.

I put everything Haskell related in a set, and if the list of the crying packages is too long, I'll just unmerge the whole haskell tree and merge the set.
Comment 6 Klaus Ethgen 2022-07-21 11:57:31 UTC
Yesterday, skylighting compiled successfull and today I have the very same Trouble with hslua:

Preprocessing library for hslua-core-2.2.0..
Building library for hslua-core-2.2.0..
ghc: panic! (the 'impossible' happened)
  (GHC version 9.0.2:
        ModOrigin: hidden module redefined

So that seems to be a heavy bug in haskell itself!
Comment 7 Jack Todaro 2022-07-23 22:20:20 UTC
(In reply to Klaus Ethgen from comment #6)
> Yesterday, skylighting compiled successfull and today I have the very same
> Trouble with hslua:
> 
> Preprocessing library for hslua-core-2.2.0..
> Building library for hslua-core-2.2.0..
> ghc: panic! (the 'impossible' happened)
>   (GHC version 9.0.2:
>         ModOrigin: hidden module redefined
> 
> So that seems to be a heavy bug in haskell itself!

Is this happening with the latest ghc in ::gentoo? It is a known upstream ghc bug, but we should be carrying patches for this in the ghc-9.0.2 ebuild.
Comment 8 Khumba 2022-07-23 22:44:32 UTC
(In reply to Zhichu Chen from comment #5)
> (In reply to Khumba from comment #4)
> > Same here, I can't rebuild skylighting-core-0.12.3.  I'll keep my old build
> > around for a bit in case there is any testing that can be done.
> 
> Just unmerge relevant packages and run haskell-updater. If that ends up
> error, do that again. Eventually, you'll get there. My record is 3 times.

Thanks, I'm sure that will fix it.  In the mean time, I'm happy to keep the broken hslua packages around for debugging if that'll help.

(In reply to Jack Todaro from comment #7)
> Is this happening with the latest ghc in ::gentoo? It is a known upstream
> ghc bug, but we should be carrying patches for this in the ghc-9.0.2 ebuild.

I'm experiencing it with ghc-9.0.2-r1::haskell, which I assume is ahead of ghc::gentoo in terms of patches.  Would that make a difference?

(I've got a mostly stable amd64 system with ~amd64 for dev-haskell/*::gentoo and */*::haskell.)
Comment 9 Jack Todaro 2022-07-23 22:52:16 UTC
(In reply to Khumba from comment #8)
> I'm experiencing it with ghc-9.0.2-r1::haskell, which I assume is ahead of
> ghc::gentoo in terms of patches.  Would that make a difference?
> 
> (I've got a mostly stable amd64 system with ~amd64 for dev-haskell/*::gentoo
> and */*::haskell.)
They should be identical: the patch in question is `ghc-9.0.2-modorigin-semigroup.patch` which was provided by ghc upstream. Just to be clear: you've done `emaint sync -r haskell` or equivalent recently and you're still getting this modorigin error? If so we may need to get in touch with upstream again, if we've exhausted other possible causes.

It's odd as I have not run into this problem (nor the other ::haskell maintainers) since we applied that patch.

The version of skylighting-core being merged should be 0.12.3.1.
Comment 10 Khumba 2022-07-31 01:32:55 UTC
(In reply to Jack Todaro from comment #9)
> (In reply to Khumba from comment #8)
> > I'm experiencing it with ghc-9.0.2-r1::haskell, which I assume is ahead of
> > ghc::gentoo in terms of patches.  Would that make a difference?
> > 
> > (I've got a mostly stable amd64 system with ~amd64 for dev-haskell/*::gentoo
> > and */*::haskell.)
> 
> They should be identical: the patch in question is
> `ghc-9.0.2-modorigin-semigroup.patch` which was provided by ghc upstream.
> Just to be clear: you've done `emaint sync -r haskell` or equivalent
> recently and you're still getting this modorigin error? If so we may need to
> get in touch with upstream again, if we've exhausted other possible causes.
> 
> It's odd as I have not run into this problem (nor the other ::haskell
> maintainers) since we applied that patch.
> 
> The version of skylighting-core being merged should be 0.12.3.1.

Yes, I have an up-to-date haskell repo:

/var/db/repos/haskell # git log | head -3
commit 05f92d39c7b9ad0d193cbd8ad7a93b1215e0860f
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Thu Jul 28 09:01:37 2022 +0000

Would it matter that I have USE=binary set on ghc?

haskell-updater hasn't made it to updating any skylighting packages yet for me.  I got this error on hslua-core, fixed it by unmerging then remerging hslua-core, and now I get the same error on hslua-classes (updating to 2.2.0::haskell from 2.1.0::haskell).  haskell-updater fails immediately on hslua-classes, then it aborts.

In case the order of merges is relevant:

# qlop -mutv ghc hslua-core hslua-classes
2021-09-05T20:12:01 >>> dev-lang/ghc-8.10.6: 2′39″
2022-01-31T12:09:28 >>> dev-haskell/hslua-core-2.0.0.2: 16s
2022-01-31T12:28:23 >>> dev-haskell/hslua-classes-2.0.0: 14s
2022-02-25T23:33:40 <<< dev-haskell/hslua-core-2.0.0.2: 3s
2022-02-25T23:36:25 <<< dev-haskell/hslua-classes-2.0.0: 3s
2022-02-26T00:40:28 >>> dev-lang/ghc-9.0.2-r1: 1′53″
2022-02-26T10:43:36 >>> dev-haskell/hslua-core-2.0.0.2: 29s
2022-02-26T10:55:02 >>> dev-haskell/hslua-classes-2.0.0: 21s
2022-04-19T21:40:34 <<< dev-haskell/hslua-core-2.0.0.2: 5s
2022-04-19T21:41:14 >>> dev-haskell/hslua-core-2.1.0: 17s
2022-04-19T21:42:07 <<< dev-haskell/hslua-classes-2.0.0: 4s
2022-04-19T22:04:15 >>> dev-haskell/hslua-classes-2.1.0: 15s
2022-07-18T22:55:16 >>> dev-lang/ghc-9.0.2-r1: 1′55″
2022-07-23T10:42:15 <<< dev-haskell/hslua-core-2.1.0: 3s
2022-07-23T10:42:30 >>> dev-haskell/hslua-core-2.2.0: 15s

(Whenever GHC itself updates I purge dev-haskell/* since I've found that necessary in the past, so all of my Haskell packages have been built with the latest GHC.)
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-31 02:00:51 UTC
Please share:
1. emerge --info
2. the full build.log of the latest failure.
Comment 12 Khumba 2022-07-31 04:32:52 UTC
Created attachment 795934 [details]
build log hslua-classes-2.2.0:20220731-042419.log
Comment 13 Khumba 2022-07-31 04:33:23 UTC
Created attachment 795937 [details]
emerge --info hslua-classes
Comment 14 Jack Todaro 2022-07-31 07:35:09 UTC
(In reply to Khumba from comment #10)
> Would it matter that I have USE=binary set on ghc?
That would be the issue - but it is not your fault.

ghc-9.0.2 was released upstream with a bug causing the panic you are getting. When we were generating the ghc-9.0.2 bootstrap binaries (which can be directly installed with USE=binary), the upstream bug wasn't found yet. We ended up running into the issue later on, reporting upstream, receiving a patch and applying it to ghc-9.0.2 - but the binary was not rebuilt to carry the patch as we had not run into the issue when building ghc-9.0.2 without USE=binary.

Until I can regenerate the binaries you may need to disable USE=binary. But I shouldn't be long if you are okay to wait.

Newer versions of ghc fix this problem upstream, so this shouldn't be an issue again in the future.

Thanks for reporting!
Comment 15 Khumba 2022-08-02 01:40:40 UTC
Ah, yes disabling USE=binary on ghc fixes it for me, thanks.  (Not sure if this is Zhichu Chen's problem?)
Comment 16 Larry the Git Cow gentoo-dev 2022-10-15 00:56:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd0927e086d7352675d44ff37500805143f3d380

commit dd0927e086d7352675d44ff37500805143f3d380
Author:     Jack Todaro <solpeth@posteo.org>
AuthorDate: 2022-10-01 23:44:43 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-10-15 00:56:53 +0000

    dev-lang/ghc: update bootstrap binary
    
    Updated bootstrap binary has been built with the upstream
    ModOrigin patch applied, as is applied when building ghc
    using default USE flags.
    
    This should resolve compilation issues for USE=binary users.
    
    Closes: https://bugs.gentoo.org/843968
    Signed-off-by: Jack Todaro <solpeth@posteo.org>
    Closes: https://github.com/gentoo/gentoo/pull/27565
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/ghc/Manifest         | 2 +-
 dev-lang/ghc/ghc-9.0.2.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 17 Timo Ollech 2023-03-24 16:45:52 UTC
It seems this bug returned from the dead with =dev-lang/ghc-9.2.7 and "dev-haskell/skylighting-core-0.13.2. This is what the zombie looks like on my system:

Preprocessing library for skylighting-core-0.13.2..
Building library for skylighting-core-0.13.2..
ghc: panic! (the 'impossible' happened)
  (GHC version 9.2.7:
        ModOrigin: hidden module redefined
  x: unusable module
  y: unusable module
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Unit/State.hs:238:14 in ghc:GHC.Unit.State


emerge --info and build log following.
Comment 18 Timo Ollech 2023-03-24 16:49:56 UTC
Created attachment 858835 [details]
emerge --info
Comment 19 Timo Ollech 2023-03-24 16:50:24 UTC
Created attachment 858837 [details]
build log
Comment 20 Timo Ollech 2023-03-24 19:21:27 UTC
Uninstalling then reinstalling dev-haskell/skylighting-core solved the problem for me.
Comment 21 vowstar 2023-03-26 08:07:30 UTC
(In reply to Timo Ollech from comment #20)
> Uninstalling then reinstalling dev-haskell/skylighting-core solved the
> problem for me.

Thanks a lot, it works for me.