When I build a Cabal project without a sandbox, Cabal uses existing libraries from my Haskell Platform installation. However, if I try to do the same inside a Cabal sandbox, Cabal forcibly rebuilds all my dependencies into the sandbox.
To save on build times and disk space, it'd be great to be able to instruct Cabal to use existing Haskell Platform libraries instead of rebuilding them. Is this possible?
Example (files in a gist):
executable blog
hs-source-dirs: .
main-is: Test.hs
build-depends: base >= 4.5 && < 5
, text
If I cabal build in the directory containing this .cabal file, my Test module gets built against the Haskell Platform version of text.
However, if I do the same in a sandbox:
cabal clean # (or alternatively clone an empty gist)
cabal sandbox init
cabal build
I get this:
$ cabal build
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
Configuring install-test-0.1...
cabal: At least the following dependencies are missing:
text -any
If I now go and cabal install, the latest text library is built from scratch under my sandbox.
git clone https://gist.github.com/8964143.git && cd 8964143 && cabal sandbox init && cabal runand this worked for me without recompiling the dependencies. cabal-install 1.18.0.2 with Cabal 1.18.1.2 on Windows. - Toxariscabal --version:cabal-install version 1.18.0.2, using version 1.18.1.1 of the Cabal library. Or it's some kind of an installation version conflict. :( - Nurpaxcabal cleanbetween the firstcabal buildand the secondcabal sandbox init && cabal build? If that works for you, what about cloning the gist and then directly doingcabal sandbox init && cabal build? I realize my instructions didn't mention the part about clean builds. I'll edit my post to include this information. - Nurpaxcabal sandbox init. Now I also triedgit clone https://gist.github.com/8964143.git && cd 8964143 && cabal build && cabal sandbox init && cabal runas well asgit clone https://gist.github.com/8964143.git && cd 8964143 && cabal build && cabal sandbox init && cabal run. They all do some configuring and compilation, and then print "hello". - Toxariscabal buildwhich means the sandboxed build does nothing. Can you trygit clone https://gist.github.com/8964143.git && cd 8964143 && cabal sandbox init && cabal run- it shouldn't work. Sorry for this back and forth. - Nurpax