1
votes

I followed "Yesod quick start guide" to install Yesod in Windows 10. But, when I issued the stack build command, it failed.

Environment

  • Windows 10 (64bits)
  • stack-0.1.5 (for Windows10 64bits)
  • No Haskell Platform

I executed these commands

  1. stack new my-project yesod-sqlite && cd my-project
  2. stack install yesod-bin cabal-install --install-ghc
  3. stack setup
  4. stack build <--- the error occured

In 'stack build' command, the package installations were done. But, when it build the project, the error occured.

Command Prompt

>stack build

Setting codepage to UTF-8 (65001) to ensure correct output from GHC
my-project-0.0.0: build
Preprocessing library my-project-0.0.0...
In-place registering my-project-0.0.0...
Preprocessing executable 'my-project' for my-project-0.0.0...
Linking .stack-work\dist\x86_64-windows\Cabal-1.22.4.0\build\my-project\my-project.exe ...
ghc.exe: could not execute: C:\Users\xxxxx\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.2\lib/../mingw/bin/gcc.exe

--  While building package my-project-0.0.0 using:
      C:\Users\xxxxx\AppData\Roaming\local\bin\stack-0.1.5.0\setup-exe-cache\setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe --builddir=.stack-work\dist\x86_64-windows\Cabal-1.22.4.0\ build lib:my-project exe:my-project --ghc-options  -ddump-hi -ddump-to-file
    Process exited with code: ExitFailure 1
1
You might need to install gcc. I don't know if Stack comes with that on Windows (most Linux boxes already have it).dfeuer
gcc is shipped with GHC itself on Windows. This includes installations via GHCMichael Snoyman

1 Answers

1
votes

This is caused by the argument length limit on Windows. Starting in GHC 7.10.3, GHC will support response files for sending linker arguments in order to bypass this limitation. In the meanwhile, a workaround is to manually make the path to your stack root shorter by setting the STACK_ROOT environment variable.

For more information, see https://www.fpcomplete.com/blog/2015/08/stack-ghc-windows