Невозможно инициализировать песочницу с помощью клики на платформе haskell

Я сделал следующие шаги, чтобы установить Cabal. Я уже установил платформу haskell, используя sudo apt-get install haskell-platform

http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html

Building Cabal from git
Assuming you already have a previous version of cabal installed:

$ git clone git://github.com/haskell/cabal.git /path/to/cabal
$ cd /path/to/cabal
$ cabal install Cabal/ cabal-install/

Однако, когда я пытаюсь инициализировать песочницу, она выдает ошибку, как показано ниже.

vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal sandbox --help
cabal: unrecognised command: sandbox (try --help)

Добавление более подробной информации:

vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ which cabal
/home/vagrant/.cabal/bin/cabal



vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal --help
This program is the command line interface to the Haskell Cabal infrastructure.
See http://www.haskell.org/cabal/ for more information.

Usage: cabal COMMAND [FLAGS]
   or: cabal [GLOBAL FLAGS]

Global flags:
 -h --help            Show this help text
 -V --version         Print version information
    --numeric-version Print just the version number

Commands:
  install      Installs a list of packages.
  update       Updates list of known packages
  list         List packages matching a search string.
  info         Display detailed information about a particular package.
  fetch        Downloads packages for later installation.
  unpack       Unpacks packages for user inspection.
  check        Check the package for common mistakes
  sdist        Generate a source distribution file (.tar.gz).
  upload       Uploads source packages to Hackage
  report       Upload build reports to a remote server.
  init         Interactively create a .cabal file.
  configure    Prepare to build the package.
  build        Make this package ready for installation.
  copy         Copy the files into the install locations.
  haddock      Generate Haddock HTML documentation.
  clean        Clean up after a build.
  hscolour     Generate HsColour colourised code, in HTML format.
  register     Register this package with the compiler.
  test         Run the test suite, if any (configure with UserHooks).
  bench        Run the benchmark, if any (configure with UserHooks).
  upgrade      (command disabled, use install instead)
  help         Help about commands

For more information about a command use:
  cabal COMMAND --help

To install Cabal packages from hackage use:
  cabal install foo [--dry-run]

Occasionally you need to update the list of available packages:
  cabal update

You can edit the cabal configuration file to set defaults:
  /home/vagrant/.cabal/config
vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal COMMAND --help
cabal: unrecognised command: COMMAND (try --help)
vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal sandbox --help
cabal: unrecognised command: sandbox (try --help)

1 ответ

Решение

Кабала установлена apt немного старше, и это, вероятно, один в вашем PATH, Он устанавливается в /usr/bin, Вы можете проверить с помощью:

which cabal

И чтобы увидеть версию:

cabal -v

Вы должны положить один в ~/.cabal/bin в вашем PATH сначала с:

export PATH="$HOME/.cabal/bin:$PATH

(Вероятно, лучше всего поместить это в ~/.bash_profile или похожие)

В моей системе:

.whogan:~$ which cabal
/home/whogan/.cabal/bin/cabal

.whogan:~$ cabal -V
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library 

.whogan:~$ /usr/bin/cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 

Изменить: Попробовал с новой коробкой Vagrant, побежал apt-get install haskell-platform и установить из git:

[vagrant@vagrantbox:~] $ git clone git://github.com/haskell/cabal.git cabal-wip
Cloning into 'cabal-wip'...
remote: Counting objects: 48926, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 48926 (delta 16), reused 0 (delta 0), pack-reused 48876
Receiving objects: 100% (48926/48926), 26.39 MiB | 10.37 MiB/s, done.
Resolving deltas: 100% (29033/29033), done.
Checking connectivity... done.

[vagrant@vagrantbox:~] $ cd cabal-wip
[vagrant@vagrantbox:~/cabal-wip][master] $ cabal install Cabal/ cabal-install/
Config file path source is default config file.
Config file /home/vagrant/.cabal/config not found.
Writing default configuration to /home/vagrant/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
Configuring Cabal-1.23.0.0...
Building Cabal-1.23.0.0...
Preprocessing library Cabal-1.23.0.0...
[ 1 of 85] Compiling Distribution.Lex ( Distribution/Lex.hs, dist/build/Distribution/Lex.o )
..
[85 of 85] Compiling Distribution.Simple ( Distribution/Simple.hs, dist/build/Distribution/Simple.o )
In-place registering Cabal-1.23.0.0...
Installing library in /home/vagrant/.cabal/lib/Cabal-1.23.0.0/ghc-7.6.3
Registering Cabal-1.23.0.0...
Installed Cabal-1.23.0.0
[1 of 1] Compiling Main             ( cabal-install/Setup.hs, cabal-install/dist/setup/Main.o )
Linking cabal-install/dist/setup/setup ...
Configuring cabal-install-1.23.0.0...
Building cabal-install-1.23.0.0...
Preprocessing executable 'cabal' for cabal-install-1.23.0.0...
[ 1 of 81] Compiling Distribution.Client.Utils.LabeledGraph ( Distribution/Client/Utils/LabeledGraph.hs, dist/build/cabal/cabal-tmp/Distribution/Client/Utils/LabeledGraph.o )
...
[81 of 81] Compiling Main             ( Main.hs, dist/build/cabal/cabal-tmp/Main.o )
Linking dist/build/cabal/cabal ...
Generating manual page dist/build/cabal/cabal.1 ...
Installing executable(s) in /home/vagrant/.cabal/bin
Installed cabal-install-1.23.0.0

Он установлен 1.23.0.0 для ~/.cabal/bin, но после этого PATH все еще указывает на системный:

[vagrant@vagrantbox:~/cabal-wip][master] $ which cabal
/usr/bin/cabal
[vagrant@vagrantbox:~/cabal-wip][master] $ cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library

Поэтому я модифицирую, чтобы сначала поставить версию user/git:

[vagrant@vagrantbox:~/cabal-wip][master] $ export PATH="~/.cabal/bin:$PATH"
[vagrant@vagrantbox:~/cabal-wip][master] $ which cabal
/home/vagrant/.cabal/bin/cabal
[vagrant@vagrantbox:~/cabal-wip][master] $ cabal -V
cabal-install version 1.23.0.0
compiled using version 1.23.0.0 of the Cabal library 

После этого все в порядке:

[vagrant@vagrantbox:~/cabal-wip][master] $ mkdir ~/tmp && cd ~/tmp
[vagrant@vagrantbox:~/tmp] $ cabal sandbox init
Writing a default package environment file to
/home/vagrant/tmp/cabal.sandbox.config
Creating a new sandbox at /home/vagrant/tmp/.cabal-sandbox

Я использовал trusty64, а не trusty32, но я надеюсь, что в этом случае это не имеет значения.

Другие вопросы по тегам