-1

我正在尝试通过 cabal 安装音乐套件以与 Haskell 一起使用。按照说明,这里http://music-suite.github.io/docs/ref/,建议下载 Lilypond,我进入cabal install lilypond并下载成功。

当我尝试通过 cabal 安装音乐套件时,问题就开始了。这是发生的事情:

mm$ cabal install music-suite
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: music-suite-1.9.0 (user goal)
[__1] trying: musicxml2-1.9.0 (dependency of music-suite)
[__2] trying: base-4.11.1.0/installed-4.1... (dependency of musicxml2)
[__3] trying: music-score-1.9.0 (dependency of music-suite)
[__4] trying: vector-space-points-0.2.1.2 (dependency of music-score)
[__5] next goal: transformers (dependency of music-score)
[__5] rejecting: transformers-0.5.5.0/installed-0.5..., transformers-0.5.6.2,
transformers-0.5.5.0, transformers-0.5.4.0, transformers-0.5.2.0,
transformers-0.5.1.0, transformers-0.5.0.1, transformers-0.5.0.0 (conflict:
music-score => transformers>=0.4.3.0 && <0.5)
[__5] rejecting: transformers-0.4.3.0 (conflict:
base==4.11.1.0/installed-4.1..., transformers => base>=2 && <4.9)
[__5] rejecting: transformers-0.4.2.0, transformers-0.4.1.0,
transformers-0.3.0.0, transformers-0.2.2.1, transformers-0.2.1.0,
transformers-0.2.0.0, transformers-0.1.4.0, transformers-0.1.3.0,
transformers-0.1.1.0, transformers-0.1.0.1, transformers-0.0.1.0,
transformers-0.0.0.0, transformers-0.5.6.1, transformers-0.5.6.0,
transformers-0.5.3.1, transformers-0.5.3.0, transformers-0.5.0.2,
transformers-0.4.0.0, transformers-0.2.2.0, transformers-0.1.0.0 (conflict:
music-score => transformers>=0.4.3.0 && <0.5)
[__5] fail (backjumping, conflict set: base, music-score, transformers)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: music-score, base, transformers,
music-suite, musicxml2, vector-space-points

究竟出了什么问题?我该如何解决这个问题?

我试图通过堆栈安装它,但出现了以下消息:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for music-suite-1.9.0:
abcnotation must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
            is 1.9.0)
lilypond must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
         is 1.9.0)
music-articulation must match ==1.9.0, but the stack configuration has no specified version  (latest matching
                   version is 1.9.0)
music-dynamics must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
               is 1.9.0)
music-dynamics-literal must match ==1.9.0, but the stack configuration has no specified version  (latest matching
                       version is 1.9.0)
music-parts must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
            is 1.9.0)
music-pitch must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
            is 1.9.0)
music-pitch-literal must match ==1.9.0, but the stack configuration has no specified version  (latest matching
                    version is 1.9.0)
music-preludes must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
               is 1.9.0)
music-score must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
            is 1.9.0)
musicxml2 must match ==1.9.0, but the stack configuration has no specified version  (latest matching version
          is 1.9.0)
needed since music-suite is a build target.

Some different approaches to resolving this:

  * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build
configuration. This can be convenient when dealing with many complicated constraint errors, but results may be
unpredictable.

  * Recommended action: try adding the following to your extra-deps
in /Users/mm/.stack/global-project/stack.yaml:

- abcnotation-1.9.0
- lilypond-1.9.0
- music-articulation-1.9.0
- music-dynamics-1.9.0
- music-dynamics-literal-1.9.0
- music-parts-1.9.0
- music-pitch-1.9.0
- music-pitch-literal-1.9.0
- music-preludes-1.9.0
- music-score-1.9.0
- musicxml2-1.9.0

我已经添加了所有这些依赖项(这里也列出了http://hackage.haskell.org/package/music-suite-1.9.0/dependenciesThe same package name is used in multiple local packagesbase-orphans used in: - PLIndex "base-orphans-0.8" - PLIndex "base-orphans-0.3.3" ),但是当我stack install music-suite在终端输入时我收到了。

当我删除其中一个依赖项时,我收到一条消息,要求恢复它们,并且我还收到以下错误:

错误:在构建构建计划时,遇到以下异常:

 In the dependencies for cassava-0.4.4.0:
base-4.12.0.0 from stack configuration does not match >=4.5 && <4.9  (latest matching version is 4.8.2.0)
 needed due to music-suite-1.9.0 -> cassava-0.4.4.0

  In the dependencies for comonad-4.3:
base-4.12.0.0 from stack configuration does not match >=0 && <0 
 needed due to music-suite-1.9.0 -> comonad-4.3

 In the dependencies for directory-1.2.7.1:
base-4.12.0.0 from stack configuration does not match >=4.5 && <4.11  (latest matching version is 4.10.1.0)
 needed due to music-suite-1.9.0 -> directory-1.2.7.1

 In the dependencies for monadplus-1.4.2:
base-4.12.0.0 from stack configuration does not match >=4 && <4.11  (latest matching version is 4.10.1.0)
 needed due to music-suite-1.9.0 -> monadplus-1.4.2

 In the dependencies for music-score-1.9.0:
base-orphans-0.8 from stack configuration does not match >=0.1 && <0.4  (latest matching version is 0.3.3)
 needed due to music-suite-1.9.0 -> music-score-1.9.0

 In the dependencies for process-1.2.3.0:
base-4.12.0.0 from stack configuration does not match >=4.4 && <4.9  (latest matching version is 4.8.2.0)
 needed due to music-suite-1.9.0 -> process-1.2.3.0

 In the dependencies for transformers-0.4.3.0:
base-4.12.0.0 from stack configuration does not match >=2 && <4.9  (latest matching version is 4.8.2.0)
 needed due to music-suite-1.9.0 -> transformers-0.4.3.0

 In the dependencies for vector-space-points-0.2.1.2:
base-4.12.0.0 from stack configuration does not match >=4.0 && <4.12  (latest matching version is 4.11.1.0)
 needed due to music-suite-1.9.0 -> vector-space-points-0.2.1.2

 Some different approaches to resolving this:

   * Set 'allow-newer: true' to ignore all version constraints and build anyway.

   * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build
configuration. This can be convenient when dealing with many complicated constraint errors, but results may be
unpredictable.
4

2 回答 2

1

您的 cabal 错误中的有效负载在这里(我已经编辑了一点,用 替换了一些非常重复的内容<...>):

[__5] next goal: transformers (dependency of music-score)
[__5] rejecting: transformers-0.5.5.0, <...> (conflict: music-score => transformers>=0.4.3.0 && <0.5)
[__5] rejecting: transformers-0.4.3.0 (conflict: base==4.11.1.0/installed-4.1..., transformers => base>=2 && <4.9)
[__5] rejecting: transformers-0.4.2.0, <...> (conflict: music-score => transformers>=0.4.3.0 && <0.5)

第 2 行和第 4 行一起表示,在transformers包的所有可能可用版本中,只有版本0.4.3.0符合music-core的约束中的版本界限。第 3 行表示transformers-0.4.3.0requires base <4.9,而您的版本base太新,无法满足该约束。

到目前为止一切都很好,只是标准的约束求解,以及 cabal 看到的约束集中出了什么问题的总结。现在对于阴谋集团没有资格给你的一些高级解释。

base是最深、最硬连线的库;它带有 GHC 并且无法更换,因此您更改base版本的唯一选择是安装不同版本的 GHC。base不幸的是,版本号和 GHC 版本号之间没有原则上的联系,尽管这里有一个表格。查阅该表,我们看到 GHC 7.10.3 是最后一个base发布 4.9 以下版本的版本。

因此,为了解决这个问题并进入下一个问题,您应该安装至少与 7.10.3 一样旧的 GHC 版本,然后告诉 cabal 在执行其约束求解时使用它。后者可以通过使新的(旧的)GHC 成为 PATH 上的第一个,或者使用 cabal 的-w标志来准确指定要使用的编译器,如下所示:

cabal install music-suite -w ghc-7.10.3
于 2019-02-23T20:55:51.130 回答
0

问题是音乐套件已经有几年没有更新了,并且不能直接使用最新的 GHC 版本构建。

希望我们可以使用“stack”,这是一个允许您指定要使用的 GHC 和包的工具。但是,我还没有找到与 Hackage 上的音乐套件包一起使用的构建计划,所以让我们从源代码构建它们:

1)安装堆栈(说明在https://haskellstack.org上)

2)可选:使用stack new mypackage(或者您可以使用自己的包)创建一个新包

3) 在您的包文件夹中,创建或编辑“stack.yaml”文件,使其包含:

resolver: lts-13.8

packages:
- .
- music-suite
- music-parts
- music-score
- music-articulation
- music-pitch
- music-dynamics
- lilypond
- musicxml2
- monadplus

extra-deps:
- average-0.6.1
- prettify-1.0
- data-interval-1.3.0
- extended-reals-0.2.3.0
- positive-0.4.1
- type-unary-0.3.2
- vector-space-points-0.2.1.2
- applicative-numbers-0.1.3
- ty-0.1.7
- reverse-apply-2.0.1
- roman-numerals-0.5.1.5

allow-newer: true

ghc-options:
   "music-score": -XUndecidableInstances

4)在您的包文件夹中,使用以下命令获取并修复音乐套件:

git clone https://github.com/music-suite/lilypond
git clone https://github.com/music-suite/music-suite
git clone https://github.com/music-suite/music-score
git clone https://github.com/music-suite/music-dynamics
git clone https://github.com/music-suite/music-parts
git clone https://github.com/music-suite/music-pitch
git clone https://github.com/music-suite/music-articulation
git clone https://github.com/music-suite/musicxml2
git clone https://github.com/hanshoglund/monadplus

echo "instance Semigroup (Partial a b) where (<>) = mplus" >> monadplus/src/Control/Monad/Plus.hs

echo "instance Semigroup RhythmContext where (<>) = mappend" >> music-score/src/Music/Score/Internal/Quantize.hs
echo "instance Semigroup CrescDim where (<>) = mappend" >> music-score/src/Music/Score/Export/DynamicNotation.hs
echo "instance Semigroup DynamicNotation where (<>) = mappend" >> music-score/src/Music/Score/Export/DynamicNotation.hs
echo "instance Semigroup Slur where (<>) = mappend" >> music-score/src/Music/Score/Export/ArticulationNotation.hs
echo "instance Semigroup Mark where (<>) = mappend" >> music-score/src/Music/Score/Export/ArticulationNotation.hs
echo "instance Semigroup ArticulationNotation where (<>) = mappend" >> music-score/src/Music/Score/Export/ArticulationNotation.hs
echo "instance Semigroup (ScScore a) where (<>) = mappend" >> music-score/src/Music/Score/Export/SuperCollider.hs
echo "instance Semigroup SystemBar where (<>) = mappend" >> music-score/src/Music/Score/Export2/StandardNotation.hs
echo "instance Semigroup StaffInfo where (<>) = mappend" >> music-score/src/Music/Score/Export2/StandardNotation.hs
echo "instance Semigroup Chord where (<>) = mappend" >> music-score/src/Music/Score/Export2/StandardNotation.hs
echo "instance Semigroup MovementInfo where (<>) = mappend" >> music-score/src/Music/Score/Export2/StandardNotation.hs
echo "instance Semigroup WorkInfo where (<>) = mappend" >> music-score/src/Music/Score/Export2/StandardNotation.hs

5)现在你可以用stack build


一个更简单的解决方案是要求在 Hackage 上发布更新的音乐套件包。

于 2019-02-22T10:51:02.467 回答