2017-05-07 83 views
-1

在我的其中一个项目中,我想使用llvm-generalllvm-general-pure,但我想使用与llvm 3.9一起工作的llvm-3.9分支,这些库的最新版本hackage适用于llvm 3.5。如何在堆栈中使用llvm-general的特定分支

我的项目是一个堆栈的项目,这是我在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语句不会编译:import LLVM.General.AST,它说,它没有找到该模块。

现在我有LLVM-一般分支3.9通过cabal install全局安装和我可以ghci -package(未stack ghci)存取,并在上述模块存在。

我尝试添加llvm-generalllvm-general-pure我依存列表与3.9.0.0版本,但堆栈似乎尝试,因为它报告有关不匹配的版本错误安装版3.5

那么如何实现我想要的?

+0

更换对应库整个location场“它报告有关版本不匹配错误,”你能发布的错误? –

回答

1

您的.cabal没有列出llvm-generalllvm-general-pure作为依赖关系,因此为什么LLVM.General.AST未找到。

此外,您的stack.yaml指向master,所以stack将只能看到版本3.5。如果不在stack.yaml文件中,stack对版本3.9并不知情。或者:

  • 将提交更改为ec1ad5bd2112e7f64dbb43441b5e2075cf6ad8e;
  • ,或者如果你有本地克隆分支,你可以用

    - location: 'path/to/llvm-general' 
        extra-dep: true 
    - location: 'path/to/llvm-general-pure' 
        extra-dep: true 
    
+0

谢谢,位置到本地克隆分支工作 – niceman