Search code examples
haskellhaskell-snap-framework

Snap web framework and dynamic recompilation


I'm building a web app with the Snap web framework. I have created a project with snap init.

I then cabal install -fdevelopment, cabal run, and I see this error when I attempt to visit the index page from chrome.

Any ideas?

A web handler threw an exception. Details:
Unknown interpreter error:

flags: '-static' not recognized

Solution

  • Here's a relevant comment from the dynamic loader:

    ------------------------------------------------------------------------------
    -- | Convert the command-line arguments passed in to options for the
    -- hint interpreter. This is somewhat brittle code, based on a few
    -- experimental datapoints regarding the structure of the command-line
    -- arguments cabal produces.
    

    It is sadly still just as brittle as when I first wrote it. This is easy to patch around hackily, but I'd still prefer a better long-term solution than just blacklisting flags that it turns out the interpreter doesn't support.

    If you're comfortable patching libraries on your system, you can add "-static" to the blacklist on line 86 of Snap/Loader/Dynamic.hs in the snap-loader-dynamic package. Otherwise, you'll have to wait until a new release gets made. It's patched on github, just waiting for a release.