Stack gives 'dyld: malformed mach-o'

2019-06-28 09:13发布

问题:

When I attempt to run stack, for example even just stack --version, I get

dyld: malformed mach-o: load commands size (38712) > 32768

What can I do to fix this. This started appearing after some recent updates to Homebrew.

回答1:

I'm guessing you've upgraded to macOS Sierra, because that message looks like you're hitting a new limit in its dynamic linker. Might be that your stack executable is dynamically linked with all the Haskell libraries it uses, which is known to exceed the new limit. You might try downloading the osx binary from the Stack releases page, which I've heard reports of working on Sierra (it's only dynamically linked to system libraries, but statically linked with Haskell libraries, so shouldn't hit the limit just to run). Note that you may still have trouble building projects with a large number of dependencies, and so far we do not have a workaround for that yet.

Related: Stack issue #2577, and GHC issue #12479.



回答2:

I also experienced the same issue when I upgraded to macOS Sierra, I was able to run Stack commands again by installing the Haskell Platform. The Stack tools included in the package seem to work.