堆栈构建结果"输出被重定向为-o,但由于没有主模块,因此不会生成输出。"

时间:2018-06-02 17:15:11

标签: haskell cabal haskell-stack

谷歌在搜索此错误时没有看到任何相关结果,所以我想发布它。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
</head>
<body>
    <ol type="1">
        <li>Install Miniconda for Python 3.6 from <a href="https://conda.io/miniconda.html">https://conda.io/miniconda.html</a></li>
        <li>Open a command prompt</li>
        <li>Type <code class="code">conda install numpy</code></li>
        <li>Type <code class="code">conda install pyopengl</code></li>
        <li>Type <code class="code">python -m pip install simpylc</code></li>
        <li>Install freeglut as explained on <a href="http://freeglut.sourceforge.net/index.php#download">http://freeglut.sourceforge.net/index.php#download</a> Alternatively, type:
            <pre>sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install freeglut3-dev</pre>
        </li>
        <li>Yet another item</li>
        <li>And yet another</li>
    </ol>
</body>
</html>

这绝对与“测试”有关。可执行定义 - 就像我删除它一样,它成功地完成了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 - 但没有所需的测试可执行文件。

gitchapter.cabal

stack build

1 个答案:

答案 0 :(得分:1)

您需要设置

executable test
  ghc-options:  -main-is Test
你的cabal文件中的