Can't compile a simple hello world using GHC 7.8rc2 and Windows 7 (or install packages with cabal)
Asked Answered
D

2

9

I can't compile a simple hello world or install packages with cabal install when using ghc 7.8, cabal 1.18.1.3 and cabal-install 1.18.0.2.

When doing a cabal install stm (or any other package) from a command prompt Windows shows a "ghc.exe has stopped working" window, and the output is:

Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install stm-2.4.2
Extracting
Waiting for install task to finish...
C:\Users\%USER%\AppData\Roaming\cabal\packages\hackage.haskell.org\stm\2.4.2\stm-2.4.2.tar.gz
to C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556...
Updating stm.cabal with the latest revision from the index.
Configuring stm-2.4.2...
creating C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2\dist\setup
creating C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2\dist
creating C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2\dist\setup
"c:\ghc-7.8.0\bin\ghc.exe" "--make" "-odir" "C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2\dist\setup" "-hidir" "C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2\dist\setup" "-i" "-iC:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2" "-package-id" "Cabal-1.18.1.3-ac8664a5c71d605f2a4a8e21170969e0" "C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2\dist\setup\setup.hs" "-o" "C:\Users\%USER%\AppData\Local\Temp\stm-2.4.2-6556\stm-2.4.2\dist\setup\setup.exe"
Failed to install stm-2.4.2
Last 10 lines of the build log ( C:\Users\%USER%\AppData\Roaming\cabal\logs\stm-2.4.2.log ):
World file is already up to date.
cabal.exe: Error: some packages failed to install:
stm-2.4.2 failed during the configure step. The exception was:
user error

I installed(?) GHC 7.8 and cabal-install with the following steps

Before doing all this, I uninstalled my previous Haskell Platform, deleted folders cabal and ghc from %USER%\AppData\Roaming, and other haskell stuff from the Program Files folder.

I am not sure if GHC needed any additional installation steps

I need GHC 7.8 because I want to try out GHCJS.

PS:

I also added LANG=C to my env variables so that compiling does not throw a UTF-8 encoding error.

cabal --version shows:

cabal-install version 1.18.0.2
using version 1.18.1 of the Cabal library

Which seems to be ok except that the cabal library shows up as 1.18.1 instead of 1.18.1.3, but i'm not sure that's an error.

ghc-pkg list shows:

c:/ghc-7.8.0\lib\package.conf.d:
Cabal-1.18.1.3
Win32-2.3.0.1
array-0.5.0.0
base-4.7.0.0
bin-package-db-0.0.0.0
binary-0.7.1.0
rts-1.0
bytestring-0.10.4.0
containers-0.5.4.0
deepseq-1.3.0.2
directory-1.2.0.2
filepath-1.3.0.2
(ghc-7.8.0.20140228)
ghc-prim-0.3.1.0
(haskell2010-1.1.1.1)
(haskell98-2.0.0.3)
hoopl-3.10.0.0
hpc-0.6.0.1
integer-gmp-0.5.1.0
old-locale-1.0.0.6
old-time-1.1.0.2
pretty-1.1.1.1
process-1.2.0.0
template-haskell-2.9.0.0
time-1.4.1
transformers-0.3.0.0

** EDIT **: Trying to compile stm manually by going into its folder and running ghc generates the same error window and gives the output:

EDIT 2: Actually, I can't even compile a simple hello world with ghc helloworld.hs:

main = putStrLn "Hello, World!"

Compiling with "-v3" gives the following (uninformative) output:

Glasgow Haskell Compiler, Version 7.8.0.20140228, stage 2 booted by GHC version 7.6.3
Using binary package database: C:\ghc-7.8.0\lib\package.conf.d\package.cache
wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-ce20d91f79b43ede95508e8cfd2188b0
wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-67cd00feecdc491a633c46b0f7652b46
wired-in package base mapped to base-4.7.0.0-d4a0afe8e5c5f0dff2237b1231b56978
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.9.0.0-f798cb95c80f3e3751ec33b413381b57
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags:
wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-ce20d91f79b43ede95508e8cfd2188b0
wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-67cd00feecdc491a633c46b0f7652b46
wired-in package base mapped to base-4.7.0.0-d4a0afe8e5c5f0dff2237b1231b56978
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.9.0.0-f798cb95c80f3e3751ec33b413381b57
wired-in package dph-seq not found.
wired-in package dph-par not found.
*** Chasing dependencies:
Chasing modules from: *asd.hs
Stable obj: []
Stable BCO: []
Ready for upsweep
  [NONREC
      ModSummary {
         ms_hs_date = 2014-03-10 04:11:51 UTC
         ms_mod = main:Main,
         ms_textual_imps = [import (implicit) Prelude]
         ms_srcimps = []
      }]
*** Deleting temp files:
Deleting:
compile: input file asd.hs
Created temporary directory: C:\Users\facuq\AppData\Local\Temp\ghc6824_1
*** Checking old interface for main:Main:
[1 of 1] Compiling Main             ( asd.hs, asd.o )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size of Desugar (after optimization)
  = {terms: 7, types: 5, coercions: 0}
*** Simplifier:
Result size of Simplifier = {terms: 7, types: 5, coercions: 0}
*** Tidy Core:
Result size of Tidy Core = {terms: 7, types: 5, coercions: 0}
*** CorePrep:
Result size of CorePrep = {terms: 9, types: 6, coercions: 0}
*** Stg2Stg:
*** CodeOutput:
*** New CodeGen:
*** CPSZ:
*** CPSZ:
Downcomer answered 10/3, 2014 at 3:45 Comment(1)
facuq: can you submit your comment as an answer and accept it to remove this question from the queue?Quintillion
D
0

It's actually a bug in GHC; it was confirmed on the GHC mailing list, and two people can reproduce it (ghc's bug manager thread).

Downcomer answered 8/4, 2015 at 10:48 Comment(0)
L
-1

your ghc.exe path and cabal.exe path should be in your path variable

It has worked for me.

Lethargy answered 22/5, 2014 at 6:20 Comment(3)
Have you been able to reproduce the error before? Just asking by interest.Therapeutic
If you have entered the link you would have seen that the bug was allready fixed, so of course It works for you. But I would bet You weren't able to reproduce it. So better don't post answers for stuff you can't even reproduce.Therapeutic
Yes, this should be locked, since the issue was fixed in a newer release, but of course still affects 7.8rc2.Downcomer

© 2022 - 2024 — McMap. All rights reserved.