I'm attempting to create simple Cabal executable package.
The Cabal user guide's "Running executables" section says:
You can have Cabal build and run your executables by using the run command.
cabal run EXECUTABLE [-- EXECUTABLE_FLAGS]
Yet when I enter that command:
$ cabal run HelloWorld
I get this error message:
cabal: unrecognised command: run (try --help)
cabal --help tells me that, indeed, there is no run command.
Am I missing something? How do I run my executable?
I'm totally new to Haskell and Cabal; please let me know what info would be helpful to include here.
I'm on Mac OS X 10.8.5.
cabal --version gives:
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library
ghc --version gives:
The Glorious Glasgow Haskell Compilation System, version 7.4.2
Your version of cabal-install is too old. The newest version of cabal-install is 1.20. You can upgrade to this version by running cabal install cabal-install.
Related
ramiro#omfg-hello:~$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
ramiro#omfg-hello:~$ sudo cabal install cabal-install --force-reinstalls
[sudo] password for ramiro:
Resolving dependencies...
Configuring cabal-install-2.4.0.0...
Building cabal-install-2.4.0.0...
Installed cabal-install-2.4.0.0
ramiro#omfg-hello:~$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
Indeed i wasn't expecting something like this. I'm stunned.
Edit:
Fixed with #duplode comment
Further edit:
Anybody knows why i'm still getting this?
ramiro#omfg-hello:~/Haskell/happstack-server$ sudo cabal new-test all
cabal: unrecognised command: new-test (try --help)
At least i get the correct cabal version now
ramiro#omfg-hello:~/Haskell/happstack-server$ cabal --v
cabal-install version 2.4.0.0
compiled using version 2.4.0.1 of the Cabal library
EditN :
ramiro#omfg-hello:~/Haskell/happstack-server$ cabal new-build
/home/ramiro/.cabal/packages/hackage.haskell.org: openBinaryTempFileWithDefaultPermissions: permission denied (Permission denied)
ramiro#omfg-hello:~/Haskell/happstack-server$ sudo cabal new-build
[sudo] password for ramiro:
Up to date
ramiro#omfg-hello:~/Haskell/happstack-server$
Non-sudo vs sudo.
Following the instructions from this post on how to update cabal-install, I seemed to be able to install the latest version (or at least some version > 1.18, which is what I wanted.
$ cabal install Cabal cabal-install
Resolving dependencies...
Configuring cabal-install-1.22.6.0...
Building cabal-install-1.22.6.0...
Preprocessing executable 'cabal' for cabal-install-1.22.6.0...
<snip>
Linking dist/build/cabal/cabal ...
Installing executable(s) in /home/kavi/.cabal/bin
Installed cabal-install-1.22.6.0
However, when I tried cabal sandbox, it failed, so I checked cabal --version.
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
As you can see, the version is not the one that cabal claimed to install.
Adding ~/.cabal/bin to my path did nothing to help. (Yes, I did restart my terminal).
$ echo $PATH
<snip>:/home/kavi/.cabal/bin
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
I tried restarting my computer, but still:
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
I am using Ubuntu 14.04.
You should add /home/kavi/.cabal/bin to the beginning of the $PATH.
which cabal tells which executable shell will pick to execute, on my machine:
% echo $PATH
/Users/ogre/.local/bin:...
% which cabal
/Users/ogre/.local/bin/cabal
I try install install glib via cabal
evgeny#virtuos:~$ cabal install glib-0.13.0.7
Resolving dependencies...
Failed to install glib-0.13.0.7
cabal: Error: some packages failed to install:
glib-0.13.0.7 failed during the configure step. The exception was:
user error (The package 'glib' requires Cabal library version -any && >=1.18
but no suitable version is installed.)
evgeny#virtuos:~$ cabal --version
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library
what's wrong?
OS: Ubuntu 14.10
Cabal 1.20.0.3
GHC: 7.6.3
Run cabal install cabal-install. Daniel Wagner's suggestion will most likely provide different results than cabal --version.
I'm trying out the tutorial about making a simple website with scotty but I get an error when I try the command "cabal sandbox init":
cabal: unrecognised command: sandbox (try --help)
Does anyone know what is wrong?
Is your Cabal/cabal-install version new enough? Sandboxes were introduced in Cabal 1.18. You can check the version with command cabal --version.
You might be able to upgrade with these commands:
cabal update
cabal install Cabal cabal-install
I'm trying to install Yesod on my Mac (running Mavericks), but installation fails because of an error installing Persistent. Specifically, cabal install persistent yields:
Failed to install persistent-1.3.0.2
Updating documentation index /Users/Max/Library/Haskell/doc/index.html
cabal: Error: some packages failed to install:
persistent-1.3.0.2 failed during the building phase. The exception was:
ExitFailure 11
(The full output is available as a gist)
I don't think this is an issue with conflicts, because I ran rm -rf ~/.ghc ~/.cabal before trying this (though I think 3 globally installed packages might not have been erased—unsure).
I'm using the latest Haskell Platform with the ghc-clang-wrapper script.
Cabal versions:
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
GHC version:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
Reinstalling Haskell platform allowed me to install Persistent, but the real issue was that I needed to install gcc48. Installing this cleared everything up. https://stackoverflow.com/a/21285413/1176156