In one of my projects I want to use llvm-general
and llvm-general-pure
but I want to use the llvm-3.9 branch which works with llvm 3.9, the latest version of these libraries on hackage are for llvm 3.5.
My project is a stack project, this is what I have in 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
All other options are left to default.
This is my 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
Unfortunately in CodeGen.hs this simple import statement doesn't compile : import LLVM.General.AST
, it says it didn't find the module.
Now I have llvm-general branch 3.9 installed globally through cabal install
and I can access it with ghci -package
(not stack ghci
) and the above module exists.
I tried adding llvm-general
and llvm-general-pure
to my dependencies list with version 3.9.0.0
but stack seems to try to install version 3.5
because it reports errors about mismatched versions.
So how to achieve what I want ?
Your .cabal
does not list llvm-general
and llvm-general-pure
as dependencies, hence why LLVM.General.AST
is not being found.
Moreover, your stack.yaml
is pointing to master
, so stack
will only see version 3.5. stack
doesn't know anything about version 3.9 if it's not in the stack.yaml
file. Either:
ec1ad5bd2112e7f64dbb43441b5e2075cf6ad8e
;or, if you have the branch cloned locally, you can replace the whole location
field corresponding to the repository with
- location: 'path/to/llvm-general'
extra-dep: true
- location: 'path/to/llvm-general-pure'
extra-dep: true