linux - 无法在 Linux 中将 cabal 升级到最新版本

标签 linux haskell ubuntu cabal

我正在尝试将 cabal 升级到最新版本,因为当前版本有一个错误:

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

似乎~/.cabal中安装了cabal 1.22.3.0,但是里面没有bin目录,只有share, packages, logs, lib 目录,我在文件夹中找不到可执行文件。

那么我可以找到我刚刚安装的新 cabal 吗?

更新:

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

最佳答案

目前在 ghc-7.10 中似乎没有办法从 1.16 升级 cabal-install(它附带并在删除 .ghc 时恢复到)。

解决方法:

  • 安装 ghc-7.8 和
  • 升级 cabal-install
  • 切换回ghc-7.10

https://mail.haskell.org/pipermail/haskell-cafe/2014-December/117512.html

对我来说幸运的是,我已经准备好用于全局切换版本的脚本:

#!/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

(可能需要根据您的 ghc 安装进行调整。)

关于linux - 无法在 Linux 中将 cabal 升级到最新版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30708737/

相关文章:

c++ - 使用 ubuntu linux 在 c++ 中进行文件重定向和编码的问题

linux - ping 或curl 无效域重定向到Linux 上的本地服务器

c++ - 防止检查时间到使用时间?

haskell - 作为类型构造函数的符号名称

haskell - 方程有不同数量的参数

输入ls后sqlite无法退出

tomcat - 如何使用ubuntu在aws ec2实例上安装tomcat

r - 绘图窗口在最小化时消失

linux - 安装 J 后,我收到几条有关 DBusMenuExporterPrivate 的错误消息

haskell - 如何在haskell中使用隐藏模块