Search code examples
haskellcabal

Cabal installation issues on Windows


I am having some issues installing packages on Windows using cabal. The following command:

cabal install ghc-mod

produces these errors

C:\temp> cabal install ghc-mod
Resolving dependencies...
Failed to install haskell-src-exts-1.15.0.1
cabal.exe: Error: some packages failed to install:
ghc-mod-4.1.3 depends on haskell-src-exts-1.15.0.1 which failed to install.
haskell-src-exts-1.15.0.1 failed while unpacking the package. The exception was:
C:\Users\...\AppData\Local\Temp\haskell-src-exts-1.15.0.1-55548\haskell-src-    exts-1.15.0.1\dist-tmp:
MoveFileEx
"C:\\Users\\...\\AppData\\Local\\Temp\\haskell-src-exts-1.15.0.1-55548\\haskell-src-exts-1.15.0.1\\dist-tmp"
"C:\\Users\\...\\AppData\\Local\\Temp\\haskell-src-exts-1.15.0.1-55548\\haskell-src-exts-1.15.0.1\\dist":
permission denied (Acesso negado.)
hlint-1.9 depends on haskell-src-exts-1.15.0.1 which failed to install.

I have also tried:

cabal install haskell-src-exts

However I got the same error.

can someone help me?

UPDATE

Output error executing cabal install haskell-src-exts:

c:\> cabal install haskell-src-exts

Resolving dependencies...
Failed to install haskell-src-exts-1.15.0.1
cabal: Error: some packages failed to install:
haskell-src-exts-1.15.0.1 failed while unpacking the package. The exception was:
C:\Users\DIULLE~1\AppData\Local\Temp\haskell-src-exts-1.15.0.1-35992\haskell-src-exts-1.15.0.1\dist-tmp: 
MoveFileEx
"C:\\Users\\DIULLE~1\\AppData\\Local\\Temp\\haskell-src-exts-1.15.0.1-35992\\haskell-src-exts-1.15.0.1\\dist-tmp"
"C:\\Users\\DIULLE~1\\AppData\\Local\\Temp\\haskell-src-exts-1.15.0.1-35992\\haskell-src-exts-1.15.0.1\\dist": 
permission denied (Acesso negado.)

Solution

  • This has been a known bug for some time1, and seems to be fixed six days ago, so update your cabal2:

    > cabal update
    > cabal install cabal cabal-install
    > cabal install ghc-mod
    

    However, if you don't want to jump on the cabal-git-train, you can still unpack, configure and install packages by hand. This will prevent the behaviour, since it is triggered by moving temporary dictionaries and name clashes:

    > cabal unpack haskell-src-exts
    > cd haskell-src-exts*
    > cabal configure
    > cabal build
    > cabal install
    

    1: since the bug has been reported on 22nd Feb, it seems to affect all versions from >= 1.18.* to < 1.20.0.3.
    2: make sure that you really run the new version.