Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic! ModOrigin: hidden module redefined #1225

Closed
hololeap opened this issue Oct 10, 2021 · 12 comments
Closed

panic! ModOrigin: hidden module redefined #1225

hololeap opened this issue Oct 10, 2021 · 12 comments

Comments

@hololeap
Copy link
Member

I'm getting this error on a couple packages:

dev-haskell/lsp-types
dev-haskell/optics-extra:

./setup haddock --hyperlink-source

...

haddock: While creating Haddock interface for Data.Text.Optics:

While creating Haddock interface for Data.Text.Optics:

haddock: panic! (the 'impossible' happened)
  (GHC version 8.10.6:
        ModOrigin: hidden module redefined

x: unusable module
y: unusable module
Call stack:
    CallStack (from HasCallStack):
      callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
      pprPanic, called at compiler/main/Packages.hs:228:14 in ghc:Packages

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

This error even crops up if you try it as a normal user using cabal
(only using v1 commands; v2 doesn't seem to have the issue):

$ cabal unpack optics-extra
$ cd optics-extra-*
$ cabal v1-build
$ cabal v1-haddock

Strangely, the workaround seems to be:

  1. emerge the package with USE="-doc"
  2. emerge the package normally

After this, everything works normally.

@solpeth
Copy link
Member

solpeth commented Oct 10, 2021

Does the use-after-doc-workaround CABAL_FEATURES option work? The naming might be wrong here, but I'm afk.

@hololeap
Copy link
Member Author

hololeap commented Oct 11, 2021

These packages have worked fine for me so far, but they suddenly started failing during a big haskell-updater run, and now they are working again after that little workaround. I just wanted to document this behavior because I think I saw it once before a while back, and others might run into the same thing.

@hololeap
Copy link
Member Author

hololeap commented Jan 28, 2022

dev-haskell/lsp-types likes to do this.

[...]
    HasResultId (src/Language/LSP/Types/Lens.hs:379)
    HasDeleteCount (src/Language/LSP/Types/Lens.hs:381)
    HasRefreshSupport (src/Language/LSP/Types/Lens.hs:384)
  97% ( 43 / 44) in 'Language.LSP.Types'
  Missing documentation for:
  Module header
  'Language.LSP.Types.Capabilities'
  Missing documentation for:
    Module header
haddock: While creating Haddock interface for Language.LSP.VFS:
While creating Haddock interface for Language.LSP.VFS:
haddock: panic! (the 'impossible' happened)
(GHC version 8.10.6:
ModOrigin: hidden module redefined

x: unusable module
y: unusable module
Call stack:
    CallStack (from HasCallStack):
      callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
      pprPanic, called at compiler/main/Packages.hs:228:14 in ghc:Packages

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


 * ERROR: dev-haskell/lsp-types-1.3.0.1::haskell failed (compile phase):
 *   failed: ./setup haddock --hyperlink-source --haddock-options=--show-all --haddock-options=--pretty-html

@solpeth
Copy link
Member

solpeth commented Jul 25, 2022

Closing as assumed to be fixed by upstream ghc patch landed in dev-lang/ghc-9.0.2-r1.

@solpeth solpeth closed this as completed Jul 25, 2022
@hololeap
Copy link
Member Author

This bug is actually separate. I'm not 100% sure of the cause, but it happened even with that patch in dev-lang/ghc-9.0.2-r1. It seems to have something to do with the packages being already installed on the system, but in a broken state due to a bumped/changed dependency (pending a haskell-updater run). This is likely something we will have to fix on our end, as this is essentially an undefined state according to ghc devs.

@hololeap hololeap reopened this Jul 26, 2022
@hololeap
Copy link
Member Author

I'm working on a more manageable solution for several issues, such as this one, which would benefit from having a more slimmed-down/isolated ghc package index during build. Creating a temporary package index which only includes the packages needed for the build, but not the package being built, should allow us to sidestep this issue.

@l29ah
Copy link
Member

l29ah commented Sep 29, 2022

I get this when i hit tab in ghci after import :

ghc: panic! (the 'impossible' happened)
  (GHC version 9.2.4:
	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

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

Leaving GHCi.

No lsp or optics here.

@hololeap
Copy link
Member Author

@l29ah have you run haskell-updater and/or emerge @preserved-rebuild?

@l29ah
Copy link
Member

l29ah commented Sep 30, 2022

Sure i did, i can't recompile a bunch of stuff, for instance skylighting-core:

>>> Compiling source in /var/tmp/portage/dev-haskell/skylighting-core-0.12.3.1/work/skylighting-core-0.12.3.1 ...
./setup build
Preprocessing library for skylighting-core-0.12.3.1..
Building library for skylighting-core-0.12.3.1..
ghc: panic! (the 'impossible' happened)
  (GHC version 9.2.4:
	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

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

@l29ah
Copy link
Member

l29ah commented Sep 30, 2022

Manually removing skylighting-core and reinstalling fixed all the problems.

@hololeap hololeap changed the title Haddock error (panic!): ModOrigin: hidden module redefined panic! ModOrigin: hidden module redefined Sep 30, 2022
@hololeap
Copy link
Member Author

This probably is just a dupe of #1250 at this point. I thought it was separate since we applied the patch.

@hololeap
Copy link
Member Author

Reported by Arsen on #gentoo-haskell:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants