[GHC] #15700: Plugins cause GHC to panic: cannot find dynamic libraries

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1 Keywords: | Operating System: Windows Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- With GHC 8.6.1 on Windows 7 x64, I seem to be getting a similar problem as in ticket #15492. Trying to use any type-checking plugin at all causes an error. Here with the natnormalise plugin: {{{ ghc.EXE: panic! (the 'impossible' happened) (GHC version 8.6.1 for x86_64-unknown-mingw32): mkPluginUsage: no dylibs, tried: C:\Code\Haskell\dylibs_bug\.stack-work\install\df4dd97d\lib\x86_64 -windows-ghc-8.6.1\libHSghc-typelits- natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll C:\Users\Sam\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin \libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll C:\Users\Sam\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib \libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll GHC.TypeLits.Normalise Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable pprPanic, called at compiler\\deSugar\\DsUsage.hs:179:15 in ghc:DsUsage }}} That's with stack. I also checked with Cabal 2.4.0.1 to make sure, and indeed I get: {{{ ghc.exe: panic! (the 'impossible' happened) (GHC version 8.6.1 for x86_64-unknown-mingw32): mkPluginUsage: no dylibs, tried: C:\Users\Sam\AppData\Roaming\cabal\store\ghc-8.6.1\ghc- typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0\lib\libHSghc- typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll C:\Program Files\ghc\mingw\lib\libHSghc- typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll GHC.TypeLits.Normalise Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable pprPanic, called at compiler\\deSugar\\DsUsage.hs:179:15 in ghc:DsUsage }}} No problems with GHC 8.4.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.2 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: Phyx- (added) * priority: normal => high * related: => #15492 * milestone: 8.6.1 => 8.6.2 Comment: Oh bother. I had hoped that #15492 would have nailed all these issues, but I suppose not. I wonder if 13105a1ae870da6936a27cdd1d6a4bd25a661368 missed a Windows-specific case. Phyx-, any ideas? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.2 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Unfortunately plugins don't work on Windows. The implementation relies on DynWay. So until that's working there's no chance on getting this to work. See #5987, #5291 and #5620. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.2 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I'm a bit confused—sheaf is reporting that this worked without issue on Windows on GHC 8.4.3. Are we perhaps thinking of different things? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.2 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Don't know, I only briefly looked at the implementation. as it currently is, it requires DynWay. but even before 13105a1ae870da6936a27cdd1d6a4bd25a661368 the only way it could work without being a shared library is if the plugin is "local", in which case it would load the object file. The comments around the code before the change suggest this shouldn't be possible, but who knows, it didn't abort before so maybe it did eventually find something to load. So maybe that's what was happening before, it thought the plugin was local instead of an external one. Dunno, never looked at plugins for longer then 30mins. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => infoneeded * priority: high => normal * milestone: 8.6.2 => Comment: Hm, OK. In any case, I'm unclear on what exact steps sheaf took to trigger this bug, so having that spelled out would help us figure out if this really is a regression or not. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Well, none of the plugin tests in the testsuite work at all, so any of them would do. In fact I have a patch to disable them since they all fail https://phabricator.haskell.org/D5174 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sheaf): Using any plugin at all triggers the bug, including an empty file e.g. {{{ {-# OPTIONS_GHC -fplugin GHC.TypeLits.Normalise #-} module Bug where }}} I don't know how plugins are set-up to work on Windows, but it doesn't seem like any DLL files are generated when I use plugins in GHC 8.4.3. From what I understand of comment:4, maybe GHC 8.4.3 on Windows could run plugins without using DLLs, whereas GHC 8.6.1 is insisting on using them when it could perhaps do without? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by sheaf): * Attachment "DsUsage.hs" added. thrown-together fix for plugin change check crash on windows -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sheaf): I'm sure this isn't news to anyone, but after testing I can confirm that plugins work on GHC 8.6.1 on Windows if one bypasses the test for whether a plugin has changed (`mkPluginUsage` in `DsUsage.hs`). So it seems the solution should be to make the functions that look up plugin locations, within `mkPluginUsage`, work correctly on Windows. The only relevant files that I can see on my machine are static `.a` files. For instance, instead of the non-existent `libHSghc- typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll`, I have `libHSghc- typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0.a`, which I have to assume is what is being used by GHC for plugin usage. \\ Does this mean mkPluginUsage should be hashing these files instead? On Windows only? The attached `DsUsage.hs` file is working on my end, inelegant as it may be. It tries looking for .a files if looking for dynamic files (.dll, .so, .dylib) fails. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by sheaf): * Attachment "DsUsage.hs" added. Fix for plugin change check crash on Windows -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sheaf): I've updated `DSUsage.hs` and checked that it works as intended on my Windows machine (both normal and profiling builds). As the fix simply adds another option (searching for static `.a` files), all programs that already compiled should still compile (including on other platforms, which I haven't tested). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by sheaf): * status: infoneeded => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): @sheaf, can you a diff instead of an updated file? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Phab:D5253 Wiki Page: | -------------------------------------+------------------------------------- Changes (by sheaf): * differential: => Phab:D5253 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Phab:D5253 Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * cc: alpmestan (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15700: Plugins cause GHC to panic: cannot find dynamic libraries
-------------------------------------+-------------------------------------
Reporter: sheaf | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.1
Resolution: | Keywords:
Operating System: Windows | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: #15492 | Differential Rev(s): Phab:D5253
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#15700: Plugins cause GHC to panic: cannot find dynamic libraries -------------------------------------+------------------------------------- Reporter: sheaf | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.2 Component: Compiler | Version: 8.6.1 Resolution: fixed | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #15492 | Differential Rev(s): Phab:D5253 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.6.2 Comment: Merged to `ghc-8.6` with d2cd150eda599d0de83fc687efc48e22a2e74a5e. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15700#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC