Fix error building hakyll site binary

Posted on September 27, 2020 by abhinav

Playing around with trying to get drafts functionality I had to build my site’s binary by running the following cabal command.

$ cabal new-install

produced this error:

site.hs:4:1: error:
    Could not find module ‘Hakyll’
    There are files missing in the ‘hakyll-’ package,
    try running 'ghc-pkg check'.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
4 | import           Hakyll
  | ^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build exe:site from hakyll-blog- See the build log
above for details.

The easy fix for this is to add the following flags --ghc-option=-dynamic.

$ cabal new-install --ghc-option=-dynamic --installdir=.