简体   繁体   中英

How to properly install Cabal 1.18.02 in Windows 7?

I'm trying to install the new Cabal in Windows 7. It successfully installs 1.18.02, but when I run "cabal --version" it shows 1.16. The folder C:\\Users\\me\\AppData\\Roaming\\cabal\\bin is at the front of my PATH.

When I directly run the 1.18 executable, I get a bunch of "cabal.exe does not exist" errors.

How can I configure Cabal to use version 1.18 by default?

There is a path conflict due the way haskell platform installs cabal.exe

As seen in this ticket

To fix it:

Delete `C:/program files(x86)/Haskell platform/lib/extralibs/bin/cabal.exe.`

In any case, you can use search tool to find which cabal.exe to delete.

I used cabal-dev to install cabal 1.18 to a sandbox, such that C:\\cabal-dev\\cabal-dev\\bin contains the latest (1.18) cabal executable. I then set C:\\Cabal-dev\\cabal-dev\\bin as the first Variable value in the "Path" variable in "systems variables" (as opposed to the "PATH" variable in "user variables"). That worked for me, and allowed me to keep the older build of cabal intact, (in case its needed later).

It worked for me. Good luck. Here are my exact steps:

  1. Install cabal-dev
    1. open command prompt anywhere
    2. execute following command: “cabal install cabal-dev”
  2. Install new cabal
    1. create directory: c:\\cabal-dev, cd to it
    2. execute following command: “cabal-dev install cabal-install”
  3. Set new, upgraded cabal path as higher priority
    1. Close any open command prompts
    2. run: Sysdm.cpl
    3. Go to the “Advanced” tab
    4. Click “Environment Variables”
    5. Select the “Path” variable listed in the “System variables” (lower) windows
    6. Click edit
    7. Add following string to the beginning of the variable value: “C:\\Cabal-dev\\cabal-dev\\bin;”
    8. Ok, Ok, Ok
    9. Ensure latest cabal is being run:
      1. Open command prompt (anywhere except c:\\cabal-dev\\ *)
      2. execute following command: “cabal –V”
      3. cabal version should be 1.18.0.2

One other possible cause of this error (aside from the cabal in extralibs problem described in another answer) is that the ld in your path can't read the .o files that GHC produces.

I hit this problem with GHC 7.8.1 RC1, and could see this going wrong by running cabal install with -v3 . The 'ld' on my path was coming from Haskell Platform 2013.2.0.0.

Adding mingw\\bin from the new GHC's directory to the path fixed the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM