堆栈构建结果为“使用-o重定向了输出,但由于没有主模块,将不会生成任何输出”。 [英] stack build results in "output was redirected with -o, but no output will be generated because there is no Main module."

查看:94
本文介绍了堆栈构建结果为“使用-o重定向了输出,但由于没有主模块,将不会生成任何输出”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Google搜索此错误时没有看到任何相关结果,以为我会发布它。

 堆栈生成
一次为gitchapter构建所有可执行文件。成功构建所有文件之后,将仅重建指定的可执行文件。
gitchapter-0.1.0.0:生成(exe)
预处理gitchapter-0.1.0.0 ..
为gitchapter-0.1.0.0 .. $ b生成可执行文件 app $ b预处理gitchapter-0.1.0.0的可执行文件 test。
警告:启用其他模块中列出的主模块 Main的解决方法
构建gitchapter-0.1的可执行文件 test。 0.0 ..
非法!

<无位置信息> ;:错误:
输出已使用-o重定向,但不会生成任何输出
,因为没有主模块。


-使用以下命令为软件包gitchapter-0.1.0.0构建自定义Setup.hs时:
/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
进程退出,代码为:ExitFailure 1

它肯定与测试可执行文件定义有关-好像我删除了它,它成功完成了 stack build -但没有必需的测试可执行文件。



gitchapter.cabal

  -该文件是由hpack 0.28.2版本从package.yaml生成的。 
-
-请参阅:https://github.com/sol/hpack
-
-哈希:a3e4a735ee8304dd50f5af53a64d7b639894cbcc24ba01d0171a588e67455018

名称: gitchapter
版本:0.1.0.0
作者:Chris Stryczynski
维护者:Chris Stryczynski
许可证:BSD3
许可证文件:LICENSE
构建类型:简单的
cabal版本:> = 1.10

可执行应用程序
main-is:Main.hs
其他模块:
BlogLiterately
示例
FileSection
GHCi
GHCiSession
Git
GitTextPartial
Hart
操作
Operations。解析器
QuasiText
渲染
部分
测试
Paths_gitchapter
hs-source-dirs:
src
构建依赖项:
HUnit
,QuickCheck
,基数> = 4.9&& < 4.11
,目录
,额外的
,文件路径
,foldl
,mtl
,optparse-applicative
,pandoc-include-代码
,parsec
,非常简单的
,处理
,regex-pcre
,regex-posix
,安全
,字符串-转换
,系统文件路径
,模板haskell
,文本
,转换器
,乌龟
,unix
,无序容器
默认语言:Haskell2010

可执行测试
主要是:Test.hs
其他模块:
BlogLiterately
示例
FileSection
GHCi
GHCiSession
Git
GitTextPartial
Hart
Main
Operations
Operations。解析器
QuasiText
渲染

Paths_gitchapter
hs-source-dirs:
src
构建依赖项:
HUnit
,QuickChe ck
,基数> = 4.9&& < 4.11
,目录
,额外的
,文件路径
,foldl
,mtl
,optparse-applicative
,pandoc-include-代码
,parsec
,非常简单的
,处理
,regex-pcre
,regex-posix
,安全
,字符串-转换
,系统文件路径
,模板haskell
,文本
,转换器
,乌龟
,unix
,无序容器
默认语言:Haskell2010


解决方案

设置

 可执行测试
ghc-options:-main-is测试
b中的


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.

这篇关于堆栈构建结果为“使用-o重定向了输出,但由于没有主模块,将不会生成任何输出”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆