user266003
user266003

Reputation:

Unable to upgrade cabal to the latest version in 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

Upvotes: 2

Views: 1345

Answers (3)

axm
axm

Reputation: 281

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.)

Upvotes: 1

ErikR
ErikR

Reputation: 52019

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

Upvotes: 0

sinelaw
sinelaw

Reputation: 16553

Try installing it using cabal itself:

cabal update
cabal install cabal-install

Upvotes: 0

Related Questions