cabal 安装和 Debian

发布于 2024-10-24 07:57:29 字数 1278 浏览 8 评论 0原文

所以,这有点个人问题,但也许人们会有好的建议或解决方法。

问题是关于在 Debian 下安装 cabal-install 和 haskell-platform 的。

当您apt-get install haskell-platform时,它会附带cabal-install,并且其命令cabal可用。

现在这个 cabal-install 不是最新的:

> which cabal
/usr/bin/cabal
> /usr/bin/cabal --version
cabal-install version 0.8.0
using version 1.8.0.2 of the Cabal library

但是,我对运行 cabal update 的理解是它更新了 cabal,但因为它不是“Debian 的东西” ”,它将其放入 ~/.cabal/bin/ 中。

> ~/.cabal/bin/cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library

现在我的系统有 2 个 cabal,而我通过输入 cabal 得到的那个不是我想要使用的……因为它会不断更新另一个而不是自身,因此无效。

所以我所做的就是在我的 ~/.bashrc 中给它起别名:

alias cabal='~/.cabal/bin/cabal'

现在:

> cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library

那么,我的最后一个问题:

  • 是否有一个包含 cabal 0.8.2 的 deb 存储库?
  • 我当前的解决方案会导致问题吗? (例如,which cabal仍然指向我无用的/usr/bin/cabal,所以如果脚本使用这个命令,他们就会被愚弄......)
  • 有人来了吗有更好的解决方案吗? (我的有点临时,但这就是我对幕后发生的事情知之甚少所能想到的……)
  • 如果我上面所说的任何内容是错误或不准确的,请纠正我。

So, this is a bit of a personal problem, but maybe people will have good advice or workarounds.

The problem is about installing cabal-install and haskell-platform under Debian.

When you apt-get install haskell-platform, it ships with cabal-install, and its command cabal is available.

Now this cabal-install is not up-to-date:

> which cabal
/usr/bin/cabal
> /usr/bin/cabal --version
cabal-install version 0.8.0
using version 1.8.0.2 of the Cabal library

But, my understanding of running cabal update is that it updates cabal, but since it is not a "Debian thingy", it puts it in ~/.cabal/bin/.

> ~/.cabal/bin/cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library

Now my system has 2 cabals, and the one I get by typing cabal is not the one I want to use... Because it'll keep updating the other one instead of itself, and is therefore ineffective.

So what I did was I aliased it in my ~/.bashrc:

alias cabal='~/.cabal/bin/cabal'

Now:

> cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library

So, my final questions:

  • Is there a deb repository that holds cabal 0.8.2?
  • Could my current solution lead to problems? (For instance, which cabal still points to my useless /usr/bin/cabal, so if scripts use this command they'll get fooled...)
  • Did someone come up with a better solution? (Mine is a bit ad-hoc but that's all I could come up to with my poor knowledge of what is happening behind the scenes...)
  • Please correct me if anything I say above is wrong or inaccurate.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

删除会话 2024-10-31 07:57:29

我所做的是使用 --global 标志安装 cabal。这会将 cabal 安装到 /usr/local/bin/cabal 中,因此它将始终取代 Debian 软件包 cabal。

另一种方法是通常避免使用 Debian 软件包并直接从源代码安装 Haskell 平台。如果您总是想拥有最新版本的 Haskell 库,这种方法也更好。

What I do is installing cabal with the --global flag. This will install cabal into /usr/local/bin/cabal, thus it will always superseed the Debian packages cabal.

Another way, is to generally avoid the Debian packages and install the Haskell platform straight from its source. This approach is also better, if you always want to have the latest releases of the Haskell libs.

独闯女儿国 2024-10-31 07:57:29

我将用户本地 $HOME/.cabal/bin 保留在 PATH 的前面。
我仅从分发包安装 ghc6ghc6-profghc6-doccabal-install。除了引导新的 ~/.cabal 之外,我不会将发行版 cabal-install 用于其他任何用途。
其余所有内容我都使用 cabal install 安装,包括较新的 cabal 本身。

当我想使用较新的 GHC 时,我将其部署在 /usr/local/stow/ghcVERSION 中,并使用 GNU stow 启用它(它在 / 中添加符号链接) usr/local 再次在我的 PATH 中具有优先权)。当我想切换回 GHC 发行版时,我只需运行 stow -D 即可删除指向它的所有符号链接。

我考虑使用cabal-dev来进行特定于项目的cabal安装,并避免cabal不时发生的破坏依赖关系。

事实上,我根本不使用 Haskell Platform,因为我不需要所有的平台,并且发现安装单独的库更容易。我不安装分发库,因为并非所有分发库都可用或正是我需要的版本;如果它们全部安装在同一个地方(在我的例子中是~/.cabal),那么控制冲突会容易得多。我不使用 --global 安装任何东西,因为我认为这是错误的并且很难回滚。

I keep my user-local $HOME/.cabal/bin in the front of the PATH.
I install only ghc6, ghc6-prof, ghc6-doc and cabal-install from the distribution packages. I don't use distribution cabal-install for anything more than to bootstrap the new ~/.cabal.
All the rest I install with cabal install, including the newer cabal itself.

When I want to use newer GHC, I deploy it in /usr/local/stow/ghcVERSION, and enable it with GNU stow (it adds symlinks in /usr/local which, again, has precedence in my PATH). When I want to switch back to the distribution GHC I just run stow -D to remove all symbolic links to it.

I consider using cabal-dev to have project-specific cabal installations, and avoid broken dependencies which happen with cabal from time to time.

As a matter of fact I don't use Haskell Platform at all because I don't need all of it and find it easier to be able to install individual libraries. I do not install distribution libraries, because not all of them are available or are exactly the versions I need; and it is much easier to control conflicts if all of them are installed in the same place (~/.cabal in my case). I do not install anything with --global, because I think it is wrong and difficult to rollback.

殊姿 2024-10-31 07:57:29

当然,这些信息已经过时了,但是,是的,在撰写本文时,Debian不稳定和测试已经有cabal-install 0.10.2。

一般来说,Haskell 的 Debian 打包是针对那些想要一组已知可以协同工作的软件包的用户,即没有依赖地狱,但代价是并不总是拥有最新和最好的。这包括 cabal 安装。我使用存储库中的 cabal-install,并且仅安装那些尚未为 Debian 打包的库。

免责声明:我是为 Debian 创建这些软件包的人之一。

Of course this information gets out of date, but yes, Debian unstable and testing have, at the time of writing, cabal-install 0.10.2.

Generally, the Debian packaging of Haskell stuff is aimed at users who want a set of packages that is known to work together, i.e. no dependency hell, at the expense of not always having the latest and greatest. This includes cabal-install. I use cabal-install from the repositories, and only to install those libraries that have not been packaged for Debian yet.

Disclaimer: I am one of the guys that create those packages for Debian.

不美如何 2024-10-31 07:57:29

在 Ubuntu 上,我也倾向于通过 stow 安装 GHC,完全忽略系统包。

jetxee 方法的一个细微变化是我安装了 Haskell Platform(从源代码),将其与 GHC stow 目录集中在一起。我想我应该调用路径 /usr/local/stow/haskell-platform-VERSION,但我倾向于使用 /usr/local/stow/ghc-VERSION反而。

On Ubuntu I also tend to install GHC via stow, ignoring the system packages altogether.

One slight twist from jetxee's approach is that I do install the Haskell Platform (from source), lumping it in with the GHC stow directory. I suppose I ought to call the paths /usr/local/stow/haskell-platform-VERSION, but I tend to use /usr/local/stow/ghc-VERSION instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文