1

Here is the error message:

[ Info  ] Merging file tree from "C:\ghcup\tmp\ghcup-d5bf0fe7341a" to "C:\ghcup\ghc\8.10.7"

[ Warn  ] Couldn't remove build dir C:\ghcup\tmp\ghcup-d5bf0fe734as: C:\ghcup\tmp\ghcup-d5bf0fe7341a01bc\ghc-8.10.7\mingw\x86_64-wgcrt0.o: removePathForcibly:removePathForcibly:removePathForciblyibly:removePathForcibly:removePathForcibly:DeleteFile "\\\\?\\C:\cup-d5bf0fe7341a01bc\\ghc-8.10.7\\mingw\\x86_64-w64-mingw32\\lib\ission denied (The process cannot access the file because it is being used by another process.)

[ Error ] Failed to merge file tree from C:\ghcup\tmp\ghcup-d5bf0-8.10.7 to C:\ghcup\ghc\8.10.7

[ ...   ] exception was: MoveFile "C:\\ghcup\\tmp\\ghcup-d5bf0fe7.10.7\\mingw\\x86_64-w64-mingw32\\lib\\binmode.o" "C:\\ghcup\\ghc\\x86_64-w64-mingw32\\lib\\binmode.o": permission denied (The process cannot access the file because it is being used by another process.)

[ ...   ] ...you may need to delete C:\ghcup\ghc\8.10.7 manually. Make sure it's gone.

[ Error ] Also check the logs in C:\ghcup\logs

I'm not sure what other process the file is being used for, I checked the logs and they say basically the same as these error messages and I tried just moving the contents of ghcup-d5bf0-8.10.7 to a folder called 8.10.7 in ghcub\ghc and I still got an error when trying to use ghci. I'm really unfamiliar with all of this, so I've just been following the instructions on Haskell.org to the letter. I am on Windows, and installed ghcup by copying the command on haskell.org/ghcup/ into PowerShell.

Update: I tried running ghcup install ghc again, and this time it seemed to successfully install. I also installed cabal and stack this way. However, running ghci still returns ghci: command not found in Git Bash. Running stack ghci returns the following:

Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.
Already downloaded.
Already downloaded.
Decompressing ghc-9.0.2.tar.xz...

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\arams\AppData\Local\Programs\stack\x86_64-windows\ghc-9.0.2.tar.xz

Extracting  ghc-9.0.2.tar

Everything is Ok

Size:       2890045440
Compressed: 487700912
Extracting ghc-9.0.2.tar...
Extracted total of 2989 files from ghc-9.0.2.tar
Problem while decompressing C:\Users\arams\AppData\Local\Programs\stack\x86_64-windows\ghc-9.0.2-tmp-56673b68e065083a\ghc-9.0.2.tar
ali_r
  • 11
  • 5
  • Which command are you running when getting this error?. Have you deleted manually this folder `C:\ghcup\ghc\8.10.7`?. Do you get this error when using `ghci`?? – lsmor Aug 07 '22 at 11:54
  • I ran `ghcup install ghc`, that folder didn't exist afterwards (`C:\ghcup\ghc` existed but was empty) and I created it to see if moving the files would help, but it didn't. As far as I know, I haven't actually got ghci, typing `ghci` into gitbash returns `bash: ghci: command not found` (which was the problem I was trying to solve in the first place) – ali_r Aug 07 '22 at 12:15
  • I think, when installing `ghcup`, both `ghc` and `cabal` should be installed too. did you install `ghcup` using the instalation script (the command given in the web) or otherwise? – lsmor Aug 08 '22 at 06:21
  • Yes, I just copied the script into powershell. I thought so too, but the first time ghcup tried to install ghc (immediately after I installed ghcup) I got exactly the above errors, as well as `"_eghcup --cache install ghc recommended" failed!`, which is why I ran `ghcup install ghc` to try again. – ali_r Aug 08 '22 at 11:27
  • So did you copy [this script](https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/scripts/bootstrap/bootstrap-haskell.ps1)? or did you execute the command [here](https://www.haskell.org/ghcup/)?. It looks like you don't have permission to install software. Is this your personal or work computer? – lsmor Aug 08 '22 at 11:37
  • I executed that command. I'm the admin on my computer, it's my personal one and I've been able to install other software recently ok. I also went to the file it references in the error message (`C:\\ghcup\\tmp\\ghcup-d5bf0fe7.10.7\\mingw\\x86_64-w64-mingw32\\lib\\binmode.o`), went into properties and allowed all the permissions for every type of user, but it didn't help at all. – ali_r Aug 08 '22 at 14:40
  • I don't know what's going on. I'd recommend: delete any folder including `ghcup` in the path and reinstall it. Also, I know someone has had a problem with the remote execution script. Maybe you can try to copy-paste the script in a local file an execute it. Also you can open an issue in the `ghcup` repository. I've checked and no one has report your problem. – lsmor Aug 09 '22 at 07:03

2 Answers2

0

Not a direct answer, but:

Haskell tools work more smoothly on Linux than on Windows.

Consider using Windows Subsystem for Linux (WSL2) instead of native Windows.

Also,the command ghcup tui shows a very convenient terminal user interface (TUI).

0

I'm not sure what the problem actually was, but running ghcup nuke (and completely deleting everything it didn't catch), then reinstalling it by running

Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true

in PowerShell solved my problem. I recently cleared out some storage, so lack of space on my disk might have been the problem?

ali_r
  • 11
  • 5