如何将 llvm-general 的特定分支与堆栈一起使用
how to use a specific branch of llvm-general with stack
在我的一个项目中,我想使用 llvm-general
和 llvm-general-pure
,但我想使用与 llvm 3.9 一起工作的 llvm-3.9 分支,这些库的最新版本 hackage 是对于 llvm 3.5。
我的项目是一个堆栈项目,这是我在stack.yaml中的项目:
resolver: nightly-2017-05-01
packages:
- '.'
- location:
git: https://github.com/bscarlet/llvm-general.git
commit: 61fd03639063283e7dc617698265cc883baf0eec
subdirs:
- llvm-general
- llvm-general-pure
extra-dep: true
所有其他选项保留为默认值。
这是我的 project.cabal :
name: compiler-final
version: 0.1.0.0
category: Compiler
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
library
hs-source-dirs: src
exposed-modules: Lexer,Parser,ParserTestData,CodeGen
other-modules: Prelude,StateTUtil
ghc-options: -Wall -dcore-lint -fhpc -XNoImplicitPrelude -fobject-code
build-depends: base-noprelude >= 4.7 && < 5 , megaparsec < 6 , transformers < 1, unordered-containers < 1 , hashable < 2
,classy-prelude , either < 5 , mono-traversable < 2 , logfloat < 0.14 , text
default-language: Haskell2010
default-extensions: OverloadedStrings
executable compiler-final-exe
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -XNoImplicitPrelude -with-rtsopts=-N -fobject-code
build-depends: base
, compiler-final
default-language: Haskell2010
default-extensions: OverloadedStrings
test-suite compiler-final-test
type: exitcode-stdio-1.0
hs-source-dirs: test
other-modules: LexerSpec , ParserSpec
main-is: Spec.hs
build-depends: base
, compiler-final, megaparsec < 6 , hspec < 3,hspec-megaparsec >= 0.3,unordered-containers < 1
,hashable,transformers < 1,text,bytestring , mtl, text
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fhpc -Wall -XNoImplicitPrelude -fobject-code
default-language: Haskell2010
default-extensions: OverloadedStrings
Benchmark compiler-final-bench
type: exitcode-stdio-1.0
hs-source-dirs: bench
main-is: Bench.hs
other-modules: ParserBench
build-depends: base,compiler-final,megaparsec < 6 ,unordered-containers < 1,QuickCheck<3
,hashable
ghc-options: -rtsopts -auto-all -caf-all -fforce-recomp -fobject-code
default-language: Haskell2010
不幸的是,在 CodeGen.hs 中,这个简单的导入语句无法编译:import LLVM.General.AST
,它说它没有找到模块。
现在我通过 cabal install
全局安装了 llvm-general 分支 3.9,我可以使用 ghci -package
(而不是 stack ghci
)访问它并且上面的模块存在。
我尝试将 llvm-general
和 llvm-general-pure
添加到版本 3.9.0.0
的依赖项列表中,但堆栈似乎尝试安装版本 3.5
,因为它报告有关版本不匹配的错误.
那么如何实现我想要的呢?
您的 .cabal
没有将 llvm-general
和 llvm-general-pure
列为依赖项,因此找不到 LLVM.General.AST
。
此外,您的 stack.yaml
指向 master
,因此 stack
只能看到 3.5 版。 stack
如果它不在 stack.yaml
文件中,则对 3.9 版一无所知。或者:
- 将提交更改为
ec1ad5bd2112e7f64dbb43441b5e2075cf6ad8e
;
或者,如果您在本地克隆了分支,则可以将与存储库对应的整个 location
字段替换为
- location: 'path/to/llvm-general'
extra-dep: true
- location: 'path/to/llvm-general-pure'
extra-dep: true
在我的一个项目中,我想使用 llvm-general
和 llvm-general-pure
,但我想使用与 llvm 3.9 一起工作的 llvm-3.9 分支,这些库的最新版本 hackage 是对于 llvm 3.5。
我的项目是一个堆栈项目,这是我在stack.yaml中的项目:
resolver: nightly-2017-05-01
packages:
- '.'
- location:
git: https://github.com/bscarlet/llvm-general.git
commit: 61fd03639063283e7dc617698265cc883baf0eec
subdirs:
- llvm-general
- llvm-general-pure
extra-dep: true
所有其他选项保留为默认值。
这是我的 project.cabal :
name: compiler-final
version: 0.1.0.0
category: Compiler
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
library
hs-source-dirs: src
exposed-modules: Lexer,Parser,ParserTestData,CodeGen
other-modules: Prelude,StateTUtil
ghc-options: -Wall -dcore-lint -fhpc -XNoImplicitPrelude -fobject-code
build-depends: base-noprelude >= 4.7 && < 5 , megaparsec < 6 , transformers < 1, unordered-containers < 1 , hashable < 2
,classy-prelude , either < 5 , mono-traversable < 2 , logfloat < 0.14 , text
default-language: Haskell2010
default-extensions: OverloadedStrings
executable compiler-final-exe
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -XNoImplicitPrelude -with-rtsopts=-N -fobject-code
build-depends: base
, compiler-final
default-language: Haskell2010
default-extensions: OverloadedStrings
test-suite compiler-final-test
type: exitcode-stdio-1.0
hs-source-dirs: test
other-modules: LexerSpec , ParserSpec
main-is: Spec.hs
build-depends: base
, compiler-final, megaparsec < 6 , hspec < 3,hspec-megaparsec >= 0.3,unordered-containers < 1
,hashable,transformers < 1,text,bytestring , mtl, text
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fhpc -Wall -XNoImplicitPrelude -fobject-code
default-language: Haskell2010
default-extensions: OverloadedStrings
Benchmark compiler-final-bench
type: exitcode-stdio-1.0
hs-source-dirs: bench
main-is: Bench.hs
other-modules: ParserBench
build-depends: base,compiler-final,megaparsec < 6 ,unordered-containers < 1,QuickCheck<3
,hashable
ghc-options: -rtsopts -auto-all -caf-all -fforce-recomp -fobject-code
default-language: Haskell2010
不幸的是,在 CodeGen.hs 中,这个简单的导入语句无法编译:import LLVM.General.AST
,它说它没有找到模块。
现在我通过 cabal install
全局安装了 llvm-general 分支 3.9,我可以使用 ghci -package
(而不是 stack ghci
)访问它并且上面的模块存在。
我尝试将 llvm-general
和 llvm-general-pure
添加到版本 3.9.0.0
的依赖项列表中,但堆栈似乎尝试安装版本 3.5
,因为它报告有关版本不匹配的错误.
那么如何实现我想要的呢?
您的 .cabal
没有将 llvm-general
和 llvm-general-pure
列为依赖项,因此找不到 LLVM.General.AST
。
此外,您的 stack.yaml
指向 master
,因此 stack
只能看到 3.5 版。 stack
如果它不在 stack.yaml
文件中,则对 3.9 版一无所知。或者:
- 将提交更改为
ec1ad5bd2112e7f64dbb43441b5e2075cf6ad8e
; 或者,如果您在本地克隆了分支,则可以将与存储库对应的整个
location
字段替换为- location: 'path/to/llvm-general' extra-dep: true - location: 'path/to/llvm-general-pure' extra-dep: true