Didn't see any relevant result when google searching for this error so thought I'd post it.
stack build
Building all executables for `gitchapter' once. After a successful build of all of them, only specified executables will be rebuilt.
gitchapter-0.1.0.0: build (exe)
Preprocessing executable 'app' for gitchapter-0.1.0.0..
Building executable 'app' for gitchapter-0.1.0.0..
Preprocessing executable 'test' for gitchapter-0.1.0.0..
Warning: Enabling workaround for Main module 'Main' listed in 'other-modules'
Building executable 'test' for gitchapter-0.1.0.0..
illegaly!
<no location info>: error:
output was redirected with -o, but no output will be generated
because there is no Main module.
-- While building custom Setup.hs for package gitchapter-0.1.0.0 using:
/home/chris/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0 build exe:app exe:test --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
It definitely is related to the 'test' executable definition - as if I remove this, it completes the stack build
successfully - but without the required test executable.
gitchapter.cabal
-- This file has been generated from package.yaml by hpack version 0.28.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: a3e4a735ee8304dd50f5af53a64d7b639894cbcc24ba01d0171a588e67455018
name: gitchapter
version: 0.1.0.0
author: Chris Stryczynski
maintainer: Chris Stryczynski
license: BSD3
license-file: LICENSE
build-type: Simple
cabal-version: >= 1.10
executable app
main-is: Main.hs
other-modules:
BlogLiterately
Example
FileSection
GHCi
GHCiSession
Git
GitTextPartial
Hart
Operations
Operations.Parsers
QuasiText
Render
Section
Test
Paths_gitchapter
hs-source-dirs:
src
build-depends:
HUnit
, QuickCheck
, base >=4.9 && <4.11
, directory
, extra
, filepath
, foldl
, mtl
, optparse-applicative
, pandoc-include-code
, parsec
, pretty-simple
, process
, regex-pcre
, regex-posix
, safe
, string-conversions
, system-filepath
, template-haskell
, text
, transformers
, turtle
, unix
, unordered-containers
default-language: Haskell2010
executable test
main-is: Test.hs
other-modules:
BlogLiterately
Example
FileSection
GHCi
GHCiSession
Git
GitTextPartial
Hart
Main
Operations
Operations.Parsers
QuasiText
Render
Section
Paths_gitchapter
hs-source-dirs:
src
build-depends:
HUnit
, QuickCheck
, base >=4.9 && <4.11
, directory
, extra
, filepath
, foldl
, mtl
, optparse-applicative
, pandoc-include-code
, parsec
, pretty-simple
, process
, regex-pcre
, regex-posix
, safe
, string-conversions
, system-filepath
, template-haskell
, text
, transformers
, turtle
, unix
, unordered-containers
default-language: Haskell2010
You need to set
executable test
ghc-options: -main-is Test
in your cabal file.