Tyrone Fishbricks
Tyrone Fishbricks

Reputation: 1

Migrating ghcup from C:\ to D:\

I'm trying to migrate GHCUP from my C:\ drive to my D:\ drive. I have adjusted my environment variables for PATH and GHCUP_INSTALL_BASE_PREFIX to show the new drive. What else do I need to change so my IDE can find the runhaskell command. My IDE can find the files within D:\ drive just fine. I just can't figure out how to get it to run through the D:\ address instead of the C:\ address which I have removed. I'm using VS Code, though I don't think it's a VS CODE issue.

PS C:\Users\blain\OneDrive\Desktop\VS_CODE> runhaskell "c:\Users\blain\OneDrive\Desktop\VS_CODE\Haskell\Hello_World.hs"

Could not create process with command 'C:\ghcup\ghc\8.10.7\bin\runhaskell.exe c:\Users\blain\OneDrive\Desktop\VS_CODE\Haskell\Hello_World.hs'.

This is the exact issue. I need the command to become:

D:\ghcup\ghc\8.10.7\bin\runhaskell.exe c:\Users\blain\OneDrive\Desktop\VS_CODE\Haskell\Hello_World.hs'.

my environment variables

variable: GHCUP_INSTALL_BASE_PREFIX

value: D:\ghcup

Path:

D:\ghcup\bin

In conclusion, I'm trying to migrate ghcup from C:\ to D:, what do I need to do to get my IDE to recognize the new home of ghcup to be D:\ and not C:\ so I can use the runhaskell command? Snip of the error

Upvotes: 0

Views: 538

Answers (1)

jakobwakob
jakobwakob

Reputation: 83

After encountering the same error I want to share my situation and solution because I think it would have solved your problem as well:

  1. I had installed GHC using GHCup as listed here: https://www.haskell.org/ghcup/
  2. During installation I changed the installation root to be in my Program Files folder, since I did not want to clutter up my C:\ root.
  3. At the first compilation GHC failed and complained with the following error: clang: error: no such file or directory: 'Files\haskell\ghcup\ghc\9.4.8\lib\../mingw/include' which meant some part of the process could not handle the space in the root path.
  4. I moved the root installation directory to the C:\ folder after all, making sure the new path had no spaces in it.
  5. I changed the PATH, GHCUP_INSTALL_BASE_PREFIX and CABAL_DIR environment variables.
  6. These are the additional steps: Go to <GHC root>\ghcup\bin
  7. Replace all occurrences in the .shim files of the old path with the new path using a tool like VS Code.
  8. Restart your editor/terminal and the ghc command should work again!

Upvotes: 2

Related Questions