2

I'm running the latest version of Haskell Platform 8.6.3 on a fairly standard Windows 10 x64 system.

Now I am at my wits end getting packages installed from Hackage to work reliably. Attributing my issues to local configuration problems, I've taken all steps short of nuking my Windows installation. I have uninstalled and reinstalled Hackage, rebooted, scoured every last configuration file I could in any hidden directory or otherwise, deleted every registry key apparently related to Haskell, most of them multiple times, all to no avail:

Packages installed with cabal just don't appear to be available under ghci, WinGHCI, either to be loaded interactively with (:m) under ghci or when compiling using ghc under WinGHCI, no matter what I do.

Below are some symptoms. Any suggestions?

#cabal new-update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
    cabal new-update 'hackage.haskell.org,2019-04-02T19:24:19Z'

#cabal new-install --lib vector
Resolving dependencies...
Up to date

#ghci
Prelude> :m Data.Vector

<no location info>: error:
    Could not find module ‘Data.Vector’
    Perhaps you meant Data.Functor (from base-4.12.0.0)

#ghc -O -optc-O3 -funfolding-use-threshold=16 -fexcess-precision -Wall -Wno-type-defaults -Wno-unused-imports -Wno-unused-top-binds -rtsopts "P663.hs"
[1 of 1] Compiling Main             ( P663.hs, P663.o )

P663.hs:54:1: error:
    Could not find module ‘Data.Vector.Unboxed’
    Use -v to see a list of the files searched for.
   |
54 | import           Data.Vector.Unboxed (Vector, (!))    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 #ghc-pkg list
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
    Cabal-2.4.0.1
    Win32-2.6.1.0
    array-0.5.3.0
    base-4.12.0.0
    binary-0.8.6.0
    bytestring-0.10.8.2
    containers-0.6.0.1
    deepseq-1.4.4.0
    directory-1.3.3.0
    filepath-1.4.2.1
    (ghc-8.6.3)
    ghc-boot-8.6.3
    ghc-boot-th-8.6.3
    ghc-compact-0.1.0.0
    ghc-heap-8.6.3
    ghc-prim-0.5.3
    ghci-8.6.3
    haskeline-0.7.4.3
    hpc-0.6.0.3
    hscolour-1.24.4
    integer-gmp-1.0.2.0
    libiserv-8.6.3
    mtl-2.2.2
    parsec-3.1.13.0
    pretty-1.1.3.6
    process-1.6.3.0
    rts-1.0
    stm-2.5.0.0
    template-haskell-2.14.0.0
    text-1.2.3.1
    time-1.8.0.2
    transformers-0.5.5.0
    xhtml-3000.2.2.1

#ghc-pkg list --user-package-db=C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
    Cabal-2.4.0.1
    Win32-2.6.1.0
    array-0.5.3.0
    base-4.12.0.0
    binary-0.8.6.0
    bytestring-0.10.8.2
    containers-0.6.0.1
    deepseq-1.4.4.0
    directory-1.3.3.0
    filepath-1.4.2.1
    (ghc-8.6.3)
    ghc-boot-8.6.3
    ghc-boot-th-8.6.3
    ghc-compact-0.1.0.0
    ghc-heap-8.6.3
    ghc-prim-0.5.3
    ghci-8.6.3
    haskeline-0.7.4.3
    hpc-0.6.0.3
    hscolour-1.24.4
    integer-gmp-1.0.2.0
    libiserv-8.6.3
    mtl-2.2.2
    parsec-3.1.13.0
    pretty-1.1.3.6
    process-1.6.3.0
    rts-1.0
    stm-2.5.0.0
    template-haskell-2.14.0.0
    text-1.2.3.1
    time-1.8.0.2
    transformers-0.5.5.0
    xhtml-3000.2.2.1

C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
    primitive-0.6.4.0
    vector-0.12.0.2

#set GHC_PACKAGE_PATH=C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db;
#ghc-pkg list
C:\Program Files\Haskell Platform\8.6.3\lib\package.conf.d
    Cabal-2.4.0.1
    Win32-2.6.1.0
    array-0.5.3.0
    base-4.12.0.0
    binary-0.8.6.0
    bytestring-0.10.8.2
    containers-0.6.0.1
    deepseq-1.4.4.0
    directory-1.3.3.0
    filepath-1.4.2.1
    (ghc-8.6.3)
    ghc-boot-8.6.3
    ghc-boot-th-8.6.3
    ghc-compact-0.1.0.0
    ghc-heap-8.6.3
    ghc-prim-0.5.3
    ghci-8.6.3
    haskeline-0.7.4.3
    hpc-0.6.0.3
    hscolour-1.24.4
    integer-gmp-1.0.2.0
    libiserv-8.6.3
    mtl-2.2.2
    parsec-3.1.13.0
    pretty-1.1.3.6
    process-1.6.3.0
    rts-1.0
    stm-2.5.0.0
    template-haskell-2.14.0.0
    text-1.2.3.1
    time-1.8.0.2
    transformers-0.5.5.0
    xhtml-3000.2.2.1

C:\Users\Carl\AppData\Roaming\ghc\x86_64-mingw32-8.6.3\package.conf.d
    (no packages)
C:\Users\Carl\AppData\Roaming\cabal\store\ghc-8.6.3\package.db
    primitive-0.6.4.0
    vector-0.12.0.2

# ghci
GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
Prelude> :m Data.Vector
Prelude Data.Vector> toList $ empty

Access violation in generated code when reading 0xffffffffffffffff

 Attempting to reconstruct a stack trace...

   Frame        Code address
 * 0x7e5dd90    0x3d7d618 C:\Program Files\Haskell Platform\8.6.3\bin\ghc.exe+0x397d618
CarlEdman
  • 398
  • 2
  • 14
  • 1
    At one point I couldn't even compile the template project with a fresh download of haskell-platform on windows. I had to revert to an earlier ghc version to get things running, and then a couple months later or so I was able to update to the latest and it worked. Might be worth a shot trying to downgrade some stuff to see if it works. – Nathan Wilson Apr 03 '19 at 14:56
  • 2
    My suggestion is to do what you know you should be doing, and use unix. You can install an image on windows. From there you can use stack. –  Apr 03 '19 at 16:19
  • @NathanWilson You may be right. The last time I recall Haskell Platform working ok was under 8.4 and I was checking for fixed to 8.6.3 daily for weeks before posting the above. Unfortunately, some of the packages I'm contributing to require 8.6. – CarlEdman Apr 03 '19 at 16:43
  • @MichaelLitchard You too may be right. I've done so in the past, but I hate losing either my graphical editors or their integration with Haskell (either one of which would be necessary, I think, if running Haskell on a VM). – CarlEdman Apr 03 '19 at 16:43
  • Let me add a few more possibly unrelated issues with a clean Haskell Platform 8.6.3 install on Windows 10 x64: 1. WinGHCI routinely hangs while executing simple code in the interpreter that ghc has no problem compiling or executing. 2. Cabal install hsdev busy-hangs at several points. 3. Cabal install hsdev fails with "opeFile: permission denied" when run as root. – CarlEdman Apr 03 '19 at 16:44
  • 4. Running compiled code under WinGHCi routinely become uninteruptible with ctrl-C, requiring restarting it and hunting down runaway processes about a dozen times a day (and that is for code which does nothing unsafe and only performs IO in main = print result). – CarlEdman Apr 03 '19 at 16:48
  • 1
    This may be a case where going with the flow gets your work done faster. Emacs makes a fine IDE, but would require learning the "Emacs Way". If you don't need much more than coloring cues, graphical vim may meet your requirements. –  Apr 03 '19 at 16:55
  • 2
    I don't know how recent your installation is, but I just installed haskell on my windows machine from scratch about a month ago, and it all worked _but I avoided Haskell Platform like the plague_ and just installed stack. It was pretty seamless – Nathan Wilson Apr 03 '19 at 17:15
  • 1
    I use stack on both linux and windows, so to be sure I'm working with a set of packages that is conflict-free. While it has its shortcomings (IMO), it greatly simplified the handling of packages. – chi Apr 03 '19 at 17:20
  • 1
    On packages not showing up when you use `ghci`, you might want to check [the default package environment file](https://downloads.haskell.org/~ghc/8.6.4/docs/html/users_guide/packages.html#package-environments) to see whether `vector` is there. In your Windows system, I *think* it will be at `C:\Users\Carl\AppData\Roaming\ghc\x86_64-mingw32-8.6.3\environments\default`. – duplode Apr 03 '19 at 21:18
  • @MichaelLitchard That is where my thoughts are going. I used to run linux under a VM, but I seem to recall that display in particular was extremely slow even on a fast machine with lots of memory. Given that I am already running an X server on my Windows machine, Xemacs that may be the way to go. And I've used emacs for 30 years, so my muscle memory speaks elisp.;) – CarlEdman Apr 03 '19 at 22:53
  • @duplode Thanks for the suggestions and apologies for not mentioning I already did: vector is listed there, as is the cabal package.db, but the file seems to be ignored by my ghci and ghc. – CarlEdman Apr 03 '19 at 22:55

2 Answers2

1

So it looks like you solved your problem by setting GHC_PACKAGE_PATH, right? You might wish to file a bug about that.

The second issue, the runtime "Access violation in generated code when reading" error seems to be documented here:

https://github.com/commercialhaskell/stack/issues/3765

https://gitlab.haskell.org/ghc/ghc/issues/13112

Supposedly passing -fexternal-interpreter to ghci is a workaround. You might want to manually edit the ghc/ghci shim scripts to ensure the flag is always passed until the bug can be fixed.

jberryman
  • 16,334
  • 5
  • 42
  • 83
  • Thanks for the suggestion! I thought that the crash might be related to me still not getting the install right, even with GHC_PACKAGE_PATH. But this may very well be a separate bug. – CarlEdman Apr 03 '19 at 17:56
  • Unfortunately, adding the `-fexternal-interpreter` flag does not fix it, but instead slightly changes the message and causes ghci to hang rather than exiting: ```$ ghci -fexternal-interpreter ... Prelude Data.Vector> toList $ empty Access violation in generated code when reading 0xffffffffffffffff Attempting to reconstruct a stack trace... Frame Code address * 0x486dd90 0xe1e1f8 C:\Program Files\Haskell Platform\8.6.3\lib\bin\ghc-iserv.exe+0xa1e1f8``` – CarlEdman Apr 03 '19 at 17:58
1

Thanks for all the responses. I've experimented both with running ghc on some version of UN*X under VirtualBox and uninstalling Haskell Platform and going purely with stack under Windows 10 x64.

Both seem to avoid the many issues I listed above, but stack under Windows seems a little more light-weight and integrates better with my preferred editors (Sublime Text and Visual Studio Code), so that is what I'm going with for now.

In the meantime, with all due gratitude for all the great, free work done by the Haskell Platform guys and the author of WinGHCI, I cannot urge anybody reading this strongly enough to stay away from it, in particular version 8.6.3 under Windows, at least until things are much improved.

CarlEdman
  • 398
  • 2
  • 14
  • This doesn't have anything to do with platform. the object code interpreter was broken in ghc 8.6.3 on Windows. 8.6.4 was released to address this. – Phyx Apr 14 '19 at 20:24
  • Fair enough. Unfortunately Platform is still stuck on 8.6.3, so it is difficult to tell for outsiders. – CarlEdman Apr 15 '19 at 21:13