Repository navigation
Description
Repro:
-
Run
stack buildin the stack source tree -
edit
src/main/Main.hsto instead havemodule Lol where -
Run
stack install
Expected: Compilation error about there being no Main module
Actual:
There were multiple candidates for the Cabal entry "Test.hs" (/home/mgsloan/fpco/stack/Test.hs), picking /home/mgsloan/fpco/stack/src/test/Test.hs
stack-1.0.5: unregistering (local file changes: src/main/Main.hs)
stack-1.0.5: build
Preprocessing library stack-1.0.5...
In-place registering stack-1.0.5...
Preprocessing executable 'stack' for stack-1.0.5...
[2 of 2] Compiling Lol ( src/main/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.7.0/build/stack/stack-tmp/Lol.o )
Warning: output was redirected with -o, but no output will be generated
because there is no Main module.
There were multiple candidates for the Cabal entry "Test.hs" (/home/mgsloan/fpco/stack/Test.hs), picking /home/mgsloan/fpco/stack/src/test/Test.hs
stack-1.0.5: copy/register
Installing library in
/home/mgsloan/fpco/stack/.stack-work/install/x86_64-linux/lts-5.3/7.10.3/lib/x86_64-linux-ghc-7.10.3/stack-1.0.5-JOr3UWYYPpY49ufhnfW8sA
Installing executable(s) in
/home/mgsloan/fpco/stack/.stack-work/install/x86_64-linux/lts-5.3/7.10.3/bin
Registering stack-1.0.5...
Copying from /home/mgsloan/fpco/stack/.stack-work/install/x86_64-linux/lts-5.3/7.10.3/bin/stack to /home/mgsloan/.local/bin/stack
Copied executables to /home/mgsloan/.local/bin:
- stack
GHC warned us with Warning: output was redirected with -o, but no output will be generated because there is no Main module.. Rather unhelpful since this should really be a failure case.... EDIT: fixed in GHC 8 https://ghc.haskell.org/trac/ghc/ticket/10895
The old executable is getting copied. I'm not sure what to do about this, due to Setup.hs potentially directing it elsewhere. Ignoring that issue, though, for simple build types, we can delete the executable. This will cause cabal copy to fail, and yield a reasonable error.
Activity
mgsloan commentedon Feb 27, 2016
Considering that this is fixed for GHC 8, my proposal is to have a special case for this:
For GHC < 8 and simple build types, delete the executables before attempting to build them.
Test that binary build succeeds
mgsloan commentedon Mar 18, 2017
GHC 8.0's fix for this seems sufficient, closing.