Unable to upgrade cabal to the latest version in Linux - linux

I'm trying to upgrade cabal to the latest version because the current version has a bug:
cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
which cabal
/usr/bin/cabal
curl http://hackage.haskell.org/package/cabal-install-1.22.3.0/cabal-install-1.22.0.3.tar.gz
tar xvfz cabal-install-1.22.3.0.tar.gz
cd cabal-install-1.22.3.0
cabal install
It seems to install cabal 1.22.3.0 in ~/.cabal but there's no bin directory in it, there're only share, packages, logs, lib directories and I can't find executable in the folder.
So can I find the new cabal which I've just installed?
UPDATE:
cabal update
cabal install cabal-install
...................
checking for sendfile in sys/socket.h... no
checking for gethostent... yes
checking for accept4... yes
configure: creating ./config.status
config.status: creating network.buildinfo
config.status: creating include/HsNetworkConfig.h
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Building network-2.6.2.0...
Preprocessing library network-2.6.2.0...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install network-2.6.2.0
Configuring old-locale-1.0.0.7...
Building old-locale-1.0.0.7...
Preprocessing library old-locale-1.0.0.7...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install old-locale-1.0.0.7
Configuring random-1.1...
Building random-1.1...
Preprocessing library random-1.1...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install random-1.1
Configuring stm-2.4.4...
Building stm-2.4.4...
Preprocessing library stm-2.4.4...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install stm-2.4.4
Configuring text-1.2.1.1...
Building text-1.2.1.1...
Preprocessing library text-1.2.1.1...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install text-1.2.1.1
Configuring zlib-0.5.4.2...
Building zlib-0.5.4.2...
Preprocessing library zlib-0.5.4.2...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install zlib-0.5.4.2
cabal: Error: some packages failed to install:
HTTP-4000.2.19 depends on text-1.2.1.1 which failed to install.
cabal-install-1.22.4.0 depends on zlib-0.5.4.2 which failed to install.
mtl-2.2.1 failed during the building phase. The exception was:
ExitFailure 1
network-2.6.2.0 failed during the building phase. The exception was:
ExitFailure 1
network-uri-2.6.0.3 depends on text-1.2.1.1 which failed to install.
old-locale-1.0.0.7 failed during the building phase. The exception was:
ExitFailure 1
old-time-1.1.0.3 depends on old-locale-1.0.0.7 which failed to install.
parsec-3.1.9 depends on text-1.2.1.1 which failed to install.
random-1.1 failed during the building phase. The exception was:
ExitFailure 1
stm-2.4.4 failed during the building phase. The exception was:
ExitFailure 1
text-1.2.1.1 failed during the building phase. The exception was:
ExitFailure 1
zlib-0.5.4.2 failed during the building phase. The exception was:
ExitFailure 1

Currently in ghc-7.10 there seems to be no way to upgrade cabal-install from 1.16 (which it is shipped with and reverts to when deleting .ghc).
Workaround:
install ghc-7.8 and
upgrade cabal-install
switch back to ghc-7.10
https://mail.haskell.org/pipermail/haskell-cafe/2014-December/117512.html
Luckily for me, I already had a script ready for switching versions globally:
#!/bin/bash -e
if [ $# -ne 1 ]; then
echo "usage: $0 <version> \# e.g.: $0 7.8.3 - being run for example in /usr/local/bin"
exit 1
fi
VERSION=$1
sudo rm ghc
sudo ln -s ghc-${VERSION} ghc
sudo rm ghci
sudo ln -s ghci-${VERSION} ghci
sudo rm ghc-pkg
sudo ln -s ghc-pkg-${VERSION} ghc-pkg
sudo rm haddock
sudo ln -s haddock-ghc-${VERSION} haddock
sudo rm runghc
sudo ln -s runghc-${VERSION} runghc
(May need adjustment depending on your ghc install.)

Try installing it using cabal itself:
cabal update
cabal install cabal-install

After running either cabal install or cabal build, look in ./dist/build/cabal/ for the built cabal binary.
You can also use this recipe:
cabal get cabal-install
cd cabal-install-1.22.4.0 # or whatever the get command says
cabal build
# binary resides in dist/build/cabal

Related

cabal-install failed to install a version that depends on the same version

I'm completely new to Haskell and I'm trying to replicate the code.world environment locally, so I need to install codeworld-api so that I can import CodeWorld. The problem is that when I run cabal install codeworld-api, it fails, and the following errors occur:
cabal: Error: some packages failed to install:
codeworld-api-0.7.0-JVbla7smM91CfqAXV0vVqz depends on codeworld-api-0.7.0
which failed to install.
haskell-src-exts-1.23.1-Z8xb2tkymYIClPofvAOw3 failed during the configure
step. The exception was:
ExitFailure 1
haskell-src-meta-0.8.7-GrcU6O1imfWLP5hRNzLFKK depends on
haskell-src-meta-0.8.7 which failed to install.
haskell-tests-0.1.0.0-IkWvWTmkph53PXtIhZGNWg depends on haskell-tests-0.1.0.0
which failed to install.
reflex-0.8.1.0-5XPDDia7wXx4bpQRZBxYDv depends on reflex-0.8.1.0 which failed
to install.
I also tried to add codeworld-api in the build-depends section in .cabal, but nothing changes.
I've read this, but --allow-newer also does nothing.
I tried, with no success:
cabal update
cabal install Cabal cabal-install
cabal new-install codeworld-api
cabal new-build
codeworld-api also doesn't show up in ghc-pkg list.
I have no idea what's happening...
Platform info
Ubuntu 20.04
cabal-install version 2.4.0.0
Cabal library version 2.4.0.1
ghc version 8.6.5
Packages installed from apt:
ghc
ghc-doc
cabal-install

Cabal install (Cabal cabal-install) fails due to missing zlib library

I want to install Cabal 3.4.0.0 on Ubuntu 20.04.
$ sudo apt install cabal-install
$ cabal --version
cabal-install version 2.4.0.0
$ sudo cabal update
$ sudo cabal install Cabal cabal-install
...
Starting zlib-0.6.2.3
Failed to install zlib-0.6.2.3
Build log ( /root/.cabal/logs/ghc-8.6.5/zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF.log ):
cabal: Entering directory '/tmp/cabal-tmp-126381/zlib-0.6.2.3'
Configuring zlib-0.6.2.3...
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: zlib.h
* Missing (or bad) C library: z
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
...
cabal: Error: some packages failed to install:
cabal-install-3.4.0.0-3glzV3hM64DLoOfz3dHKsn depends on cabal-install-3.4.0.0
which failed to install.
hackage-security-0.6.0.1-KiAyVYLxooJAP3ckeQHnBD depends on
hackage-security-0.6.0.1 which failed to install.
zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF failed during the configure step. The
exception was:
ExitFailure 1
The error says:
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version).
How can I install this package on Ubuntu 20.04?
You aim to install the cabal-install package. This package has a dependency that here produces a problem: the zlib package.
This zlib package is essentially a thin wrapper around the zlib C library [wikipedia]. As the error says however, you did not install the zlib library, or at least not its package where one can develop with the zlib library.
We can install this by installing the libghc-zlib-dev software package, for example with:
sudo apt-get install libghc-zlib-dev
If we inspect the package details on Debian, we see that essentially this is a package that will install the zlib1g-dev package, the package to develop software with the zlib library. We can thus decide to install libghc-zlib-dev, or zlib1g-dev with:
sudo apt-get install zlib1g-dev
Nixos Users append pkgs.haskellPackages.zlib to environment.systemPackages

cant install cabal package

I have a problem with installing quickcheck from cabal on ubuntu 14.4 LTS. I have updated cabal, but when i try to install quickcheck an error comes up:
:~$ cabal install quickcheck
Resolving dependencies...
Configuring primitive-0.6.1.0...
Building primitive-0.6.1.0...
Preprocessing library primitive-0.6.1.0...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install primitive-0.6.1.0
Configuring random-1.1...
Building random-1.1...
Preprocessing library random-1.1...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install random-1.1
cabal: Error: some packages failed to install:
QuickCheck-2.8.1 depends on random-1.1 which failed to install.
primitive-0.6.1.0 failed during the building phase. The exception was:
ExitFailure 1
random-1.1 failed during the building phase. The exception was:
ExitFailure 1
tf-random-0.5 depends on random-1.1 which failed to install.
I am pretty new ubuntu so I still dont know what to do in a situation like this. i really hope someone can help because it is for a school project which is do soon.
After spending hours on installing/removing, the best way to install and configure latest cabal, ghc...
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
This error occurs when you have a very old cabal binary compared to your version of ghc.
You could jump through the package manager routes, or you could use the linux binary download from https://www.haskell.org/cabal/download.html
That should suffice to get you off the ground...

Failed to install Darcs - Ubuntu 14.04 x64 - darcs 2.8.4 - cabal 1.20.0.2

I have a problem in installing darcs
$ cabal install darcs-2.8.4
/tmp/darcs-2.8.4-26031/darcs-2.8.4/Setup.lhs:106:3: Warning:
In the use of `runTests'
(imported from Distribution.Simple, but defined in Distribution.SimpleLinking /tmp/darcs-2.8.4-26031/darcs-2.8.4/dist/setup/setup ...
Configuring dsetup: Unable to link against the iconv library.
cabal: Error: some packages failed to install:
darcs-2.8.4 failed during the configure step. The exception was:
ExitFailure 1
darcs seems to need development files for libcurl. So, install libcurl4-gnutls-dev in Ubuntu:
sudo apt-get install libcurl4-gnutls-dev
Once you have installed that, install darcs using the usual cabal install method.

Cabal fails to install Idris language on OSX Lion

I'm trying to install the Idris language in an OSX Lion using the installation guide provided on the official tutorial. I have alraedy installed GMP. This is the error I get:
$ cabal install idris
Resolving dependencies...
Configuring libffi-0.1...
cabal: The pkg-config package libffi is required but it could not be found.
[1 of 1] Compiling Main ( /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/T/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/Setup.hs, /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/T/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/dist/setup/Main.o )
Linking /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/T/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/dist/setup/setup ...
setup: The program llvm-config version ==3.3.* is required but it could not be
found.
cabal: Error: some packages failed to install:
idris-0.9.9 depends on llvm-general-3.3.5.0 which failed to install.
libffi-0.1 failed during the configure step. The exception was:
ExitFailure 1
llvm-general-3.3.5.0 failed during the configure step. The exception was:
ExitFailure 1
Trying to install Idris without LLVM produces this error:
$ cabal install idris -f-LLVM
Resolving dependencies...
Configuring libffi-0.1...
cabal: The pkg-config package libffi is required but it could not be found.
cabal: Error: some packages failed to install:
idris-0.9.9 depends on libffi-0.1 which failed to install.
libffi-0.1 failed during the configure step. The exception was:
ExitFailure 1
I was having this same problem on OSX Mavericks. To get Idris to compile, I used homebrew to install gmp, then I had to do 'export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig', and then 'cabal install idris -f-LLVM'. I got the tip to export the PKG_CONFIG_PATH variable from this site:
https://groups.google.com/d/msg/idris-lang/gxcdvRIA2OI/NqKSd4zHkI4J
Mavericks already had libffi installed, and I didn't want to install a second copy from source, which is what the PKG_CONFIG_PATH trick helped me avoid. Do 'brew info libffi' to find the correct path to export. Hopefully someone will create a homebrew formula for Idris soon...
The first error indicates you should install the LLVM development packages of your distribution (not through cabal) and the second indicates you should install the development package for the GCC libffi library. What Linux distribution are you using? Or are you on Windows/Mac?

Resources