commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
4k stars 844 forks source link

Cannot build executable-hash with stack #304

Closed borsboom closed 9 years ago

borsboom commented 9 years ago
$ stack unpack executable-hash
Unpacked executable-hash-0.2.0.0 to /Users/manny/fpco/tmp/executable-hash-0.2.0.0/
$ cd executable-hash-0.2.0.0/
$ echo 'resolver: lts-2.14' >stack.yaml
$ stack build
Downloaded lts-2.14 build plan.
Fetched package index.                                                                            Populated index cache.
file-embed-0.0.8.2: downloading
byteable-0.1.1: downloading
file-embed-0.0.8.2: configure
executable-path-0.0.3: downloading
byteable-0.1.1: configure
file-embed-0.0.8.2: build
executable-path-0.0.3: configure
byteable-0.1.1: build
executable-path-0.0.3: build
byteable-0.1.1: install
file-embed-0.0.8.2: install
executable-path-0.0.3: install
cryptohash-0.11.6: downloading
cryptohash-0.11.6: configure
cryptohash-0.11.6: build
cryptohash-0.11.6: install
executable-hash-0.2.0.0: configure
Progress: 4/5
System/Executable/Hash/Internal.hs:8:18:
    Could not find module ‘Crypto.Hash.SHA1’
    Use -v to see a list of the files searched for.

System/Executable/Hash/Internal.hs:10:18:
    Could not find module ‘Data.FileEmbed’
    Use -v to see a list of the files searched for.
Completed all 5 actions.

--  While building package executable-hash-0.2.0.0 using:
      /Applications/ghc-7.8.4.app/Contents/bin/runhaskell -package=Cabal-1.18.1.5 -clear-package-db -global-package-db /Users/manny/fpco/tmp/executable-hash-0.2.0.0/Setup.hs --builddir=.stack-work/dist/x86_64-osx/Cabal-1.18.1.5/ configure --user --package-db=clear --package-db=global --package-db=/Users/manny/.stack/snapshots/x86_64-osx/lts-2.14/7.8.4/pkgdb/ --package-db=/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.stack-work/install/x86_64-osx/lts-2.14/7.8.4/pkgdb/ --constraint=base==4.7.0.2 --constraint=bytestring==0.10.4.0 --constraint=cryptohash==0.11.6 --constraint=directory==1.2.1.0 --constraint=executable-path==0.0.3 --constraint=file-embed==0.0.8.2 --constraint=template-haskell==2.9.0.0 --libdir=/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.stack-work/install/x86_64-osx/lts-2.14/7.8.4/lib --bindir=/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.stack-work/install/x86_64-osx/lts-2.14/7.8.4/bin --datadir=/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.stack-work/install/x86_64-osx/lts-2.14/7.8.4/share --docdir=/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.stack-work/install/x86_64-osx/lts-2.14/7.8.4/doc
    Process exited with code: ExitFailure 1

However, cabal-install seems to work fine with the same LTS snapshot:

$ wget -q https://www.stackage.org/lts-2.14/cabal.config
$ cabal sandbox init
Writing a default package environment file to
/Users/manny/fpco/tmp/executable-hash-0.2.0.0/cabal.sandbox.config
Creating a new sandbox at
/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.cabal-sandbox
$ cabal install
Resolving dependencies...
Notice: installing into a sandbox located at
/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.cabal-sandbox
Configuring byteable-0.1.1...
Configuring executable-path-0.0.3...
Configuring file-embed-0.0.8.2...
Building byteable-0.1.1...
Building file-embed-0.0.8.2...
Building executable-path-0.0.3...
Installed byteable-0.1.1
Configuring cryptohash-0.11.6...
Installed executable-path-0.0.3
Building cryptohash-0.11.6...
Installed file-embed-0.0.8.2
Installed cryptohash-0.11.6
Configuring executable-hash-0.2.0.0...
Building executable-hash-0.2.0.0...
Installed executable-hash-0.2.0.0
Updating documentation index
/Users/manny/fpco/tmp/executable-hash-0.2.0.0/.cabal-sandbox/share/doc/x86_64-osx-ghc-7.8.4/index.html

cc @mgsloan

snoyberg commented 9 years ago

That's because @mgsloan is way too evil :). The Setup.hs file depends on the library itself, and therefore needs access to the package database at configure time, which we're specifically not allowing. I recommend we change executable-hash to not use this trick, the only way to get that trick to work is to take off a lot of the safety that stack is providing over cabal.

snoyberg commented 9 years ago

OK, I backpedaled on this and just gave access to the snapshot database when running Setup.hs, with a big caveat in the text. @manny-fp confirmed?