1

I can compile Hakyll, but when I try to run it I get a linking error.
First I install Hakyll in a sandbox:

cabal sandbox init
cabal install Hakyll

This completes successfully. Then I create a plain site using hakyll-init and move the files up a directory:

.cabal-sandbox/bin/hakyll-init mysite
mv mysite/* .
rm -rf mysite

Then I try to run it with cabal exec -- runghc site.hs build and I get:

site.hs: <command line>: can't load .so/.DLL for: /Users/john/repositories/CP/principles-of-concurrent-programming/Website/.cabal-sandbox/lib/x86_64-osx-ghc-8.2.1/libHSpandoc-citeproc-0.10.5.1-97wWmtk04v65Etcjop52Rs-ghc8.2.1.dylib (dlopen(/Users/john/repositories/CP/principles-of-concurrent-programming/Website/.cabal-sandbox/lib/x86_64-osx-ghc-8.2.1/libHSpandoc-citeproc-0.10.5.1-97wWmtk04v65Etcjop52Rs-ghc8.2.1.dylib, 5): no suitable image found.  Did find:
    /Users/john/repositories/CP/principles-of-concurrent-programming/Website/.cabal-sandbox/lib/x86_64-osx-ghc-8.2.1/libHSpandoc-citeproc-0.10.5.1-97wWmtk04v65Etcjop52Rs-ghc8.2.1.dylib: malformed mach-o: load commands size (32992) > 32768
    /Users/john/repositories/CP/principles-of-concurrent-programming/Website/.cabal-sandbox/lib/x86_64-osx-ghc-8.2.1/libHSpandoc-citeproc-0.10.5.1-97wWmtk04v65Etcjop52Rs-ghc8.2.1.dylib: malformed mach-o: load commands size (32992) > 32768)
  • The contents of site.hs are completely standard. I've uploaded the file to gist.
  • GHC 8.2.1, installed via Homebrew. I initially had this problem with 7.10.3b, and upgraded GHC to see if that would help. It didn't.
  • macOS Sierra 10.12.6

Any help would be appreciated!

John J. Camilleri
  • 4,171
  • 5
  • 31
  • 41
  • 1
    Try installing via stack and see if that works. – Sibi Aug 24 '17 at 10:47
  • 1
    You can also use Nix to install it. The hakyll build for darwin succeeds in the latest version of nixpkgs. Sadly, I can't test it because I don't have an OS X machine at my disposal. You can get Nix at https://nixos.org/nix/ and try: `nix-build -iA haskellPackages.hakyll -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/6bbc3a0b245ccf392a8ddbce41b372c17409f0e9.tar.gz` – Robert Hensing Aug 24 '17 at 11:50
  • can you show your website.hs? – Marc Lambrichs Aug 24 '17 at 16:43
  • @mlambrichs I've updated the question to specify that this happens with a completely fresh site generated using `hakyll-init`. – John J. Camilleri Aug 25 '17 at 07:02
  • @Sibi just tried with stack and indeed it works great. I guess I will post this as an answer – John J. Camilleri Aug 25 '17 at 07:51

1 Answers1

2

Although not exactly a solution to my problem, I managed to get around this by installing Hakyll through stack instead. For the record, these were my steps:

brew install haskell-stack
stack setup
stack install hakyll

Then to build the website:

stack exec -- runghc site.hs build
John J. Camilleri
  • 4,171
  • 5
  • 31
  • 41