包装版本冲突在Cabal [英] Package versioning clashes in Cabal

查看:99
本文介绍了包装版本冲突在Cabal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原谅我,如果这是一个FAQ,但我对如何正确解决这个问题有点困惑。

Forgive me if this is a FAQ but I'm a bit puzzled about how to get around this problem properly.

我最近下载了一个包 TagSoup 安装了最新版本 0.12.2

I recently downloaded the package TagSoup which installed fine with the latest version 0.12.2

然后我安装了软件包 download-卷曲,它安装了最新版本的罚款。我没有意识到的是,下载卷曲依赖于TagSoup,版本=< 0.11,所以作为安装过程的一部分,Cabal也下载了一个老版本的TagSoup。

Then I installed the package download-curl which installed fine with the latest version. What I failed to realise was, download-curl depends on TagSoup with a version =< 0.11, so as part of the installation process Cabal downloaded an older version of TagSoup too.

这是一个问题,因为我想使用这两个库(最新版本的TagSoup和下载 - 卷曲) - 当你出于某种原因而做GHCI有点乱。

This is a problem because I want to use both libraries (the latest version of TagSoup AND download-curl) - and when you do for some reason GHCI gets in a bit of a mess.

我的问题是,有没有一种方法可以指定你的版本import语句,即

My question is, is there a way of specifying versions in your import statements, i.e.

import Text.Html.TagSoup-0.12.2

还是这是不行?我不想。

or is this a no go? I'm thinking not.

我解决这个问题的唯一方法是下载下载卷曲源代码,将 .cabal 文件修改为使用TagSoup-0.12.2,并重新安装我的小黑客的包,这是我所期望的 - 但我不认为这是解决方案。

The only way I got around this was to download the download-curl source, modify the .cabal file to use TagSoup-0.12.2 and reinstalled the package with my little "hack" in place which works as I would expect it to - but I don't think this is the solution

>

推荐答案

通常在 .cabal 中指定所需的版本

Normally one specifies the required version in the .cabal file. There is an extension syntax for specific package imports (-XPackageImports) but it's usually better to let Cabal deal.

也就是说,如果你需要同时使用,那么你进入钻石依赖的黑暗领域。你们几乎是目前唯一可用的解决方案。 -XPackageImports 不是这里是一个好主意,因为试图在同一个程序中使用同一个库的两个版本可能不会链接和几乎肯定会在运行时转储核心,如果它 管理链接没有重复的符号。

That said, yes, if you need to use both then you enter the dark realm of diamond dependencies. Yours is pretty much the only solution available currently. -XPackageImports is not a good idea here, as trying to use two versions of the same library in the same program probably won't link and almost certainly will dump core at runtime if it does manage to link without duplicate symbols.

这篇关于包装版本冲突在Cabal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆