Main-Is not creating executable

I have this in Takusen.cabal: Executable miniunit_tests Main-Is: Test/MiniUnit/Main.hs Build-Depends: base, mtl Extensions: CPP CPP-Options: "-DNEW_EXCEPTION" (as well as the Library section). When it builds, the modules compile fine, but then I get: Warning: output was redirected with -o, but no output will be generated because there is no Main module. The ghc command (from setup -v build): Building executable: miniunit_tests... Creating dist\build\miniunit_tests (and its parents) Creating dist\build\miniunit_tests\miniunit_tests-tmp (and its parents) c:\ghc\ghc-6.10.1\bin\ghc.exe -o dist\build\miniunit_tests\miniunit_tests.exe -- make -hide-all-packages -no-user-package-conf -i -idist\build\miniunit_tests\min iunit_tests-tmp -i. -idist\build\autogen -Idist\build\autogen -Idist\build\miniu nit_tests\miniunit_tests-tmp -optP-DNEW_EXCEPTION -optP-include -optPdist\build\ autogen\cabal_macros.h -odir dist\build\miniunit_tests\miniunit_tests-tmp -hidir dist\build\miniunit_tests\miniunit_tests-tmp -stubdir dist\build\miniunit_tests \miniunit_tests-tmp -package QuickCheck-1.2.0.0 -package Takusen-0.8.4 -package base-4.0.0.0 -package mtl-1.1.0.2 -package old-time-1.0.0.1 -package time-1.1.2. 2 -O -XCPP .\Test/MiniUnit/Main.hs I don't see ghc flag -main-is in here. What do I need to do to get it to build the executable? Also, is there a way to get it to just build miniunit_tests.exe i.e. without rebuilding the library and another executable target? Alistair

2009/1/20 Alistair Bayley
I have this in Takusen.cabal:
Executable miniunit_tests Main-Is: Test/MiniUnit/Main.hs Build-Depends: base, mtl Extensions: CPP CPP-Options: "-DNEW_EXCEPTION"
(as well as the Library section). When it builds, the modules compile fine, but then I get:
Warning: output was redirected with -o, but no output will be generated because there is no Main module.
My fault. Turns out the module in Test/MiniUnit/Main.hs must be just Main, not Test.MiniUnit.Main i.e. module Main where... But the second question still stands: can I selectively build the various targets in the .cabal file? Alistair

On Tue, 2009-01-20 at 20:30 +0000, Alistair Bayley wrote:
2009/1/20 Alistair Bayley
: I have this in Takusen.cabal:
Executable miniunit_tests Main-Is: Test/MiniUnit/Main.hs Build-Depends: base, mtl Extensions: CPP CPP-Options: "-DNEW_EXCEPTION"
(as well as the Library section). When it builds, the modules compile fine, but then I get:
Warning: output was redirected with -o, but no output will be generated because there is no Main module.
My fault. Turns out the module in Test/MiniUnit/Main.hs must be just Main, not Test.MiniUnit.Main i.e. module Main where...
Right. See http://hackage.haskell.org/trac/hackage/ticket/179
But the second question still stands: can I selectively build the various targets in the .cabal file?
Not yet, sorry. This is something that we will be able to do easily with the Cabal-2.x features, though we may well be able to do it before then, at least for "big" targets like executables and libs. So it's worth filing a feature request ticket. I usually ask for suggestions for the user interaction but in this case the obvious seems to be: cabal build miniunit_tests Btw, what you really want here is proper support for testsuites, rather than executable: http://hackage.haskell.org/trac/hackage/ticket/215 Duncan
participants (2)
-
Alistair Bayley
-
Duncan Coutts