Windows: `stack exec foo` works, foo.exe does not #425

Closed
rubenmoor opened this Issue Jun 26, 2015 · 8 comments

Projects

None yet

3 participants

@rubenmoor
Contributor

On windows stack build and stack exec foo works (which is great, btw). My program is running.

However, after stack install the execution of the executable file fails.

.\foo.exe -> complaint about missing library "libstdc++-6.dll"

I have no understanding of what stack exec does in windows (magic?). Any hint to what's going on?

@snoyberg
Contributor

Most likely Windows is not able to find the necessary C++ libraries from the standard prompt because they're not on your PATH. stack exec works because it's modifying the PATH to include extra things. Options here would be:

  • Copy the relevant .dll files to something on your PATH
  • Modify your PATH to include extra directories

In theory, stack could copy some DLLs over to the output directory for you, but that seems out-of-scope for what it's doing.

@snoyberg snoyberg added this to the 0.2.0.0 milestone Jun 26, 2015
@rubenmoor
Contributor

Cool, thanks. I assume these libraries are created by stack during stack build. Where are they stored, i.e. what directories to include in my PATH?

@snoyberg
Contributor

Actually, they're not, they're shipped with GHC (and, theoretically in some cases, MSYS). The easiest way to find them is stack exec which. On my system, for instance:

>stack exec which libstdc++-6.dll
/c/Users/Michael/AppData/Local/Programs/stack/i386-windows/ghc-7.8.4/mingw/bin/libstdc++-6.dll
@snoyberg
Contributor

If that turns out to resolve it for you, would you be able to add a FAQ entry on the Wiki about this?

@radix
Contributor
radix commented Jun 26, 2015

perhaps an idea for a future plugin: bundle up a self-contained windows executable or installer?

@snoyberg
Contributor

Sounds like what we're doing with docker. Mind opening as a separate issue?
I don't want to lose track of it.

On Fri, Jun 26, 2015, 6:28 PM Christopher Armstrong <
notifications@github.com> wrote:

perhaps an idea for a future plugin: bundle up a self-contained windows
executable or installer?


Reply to this email directly or view it on GitHub
#425 (comment)
.

@rubenmoor
Contributor

If that turns out to resolve it for you, would you be able to add a FAQ entry on the Wiki about this?

Done

@snoyberg
Contributor

Thanks!

@snoyberg snoyberg closed this Jun 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment