Search code examples
haskellcabalghcitemplate-haskellhappstack

GHCi interactive linking error during happstack-server installation


I’m trying to build a project in a cabal sandbox that depends on happstack-server, but this package fails to build. Here is the content of .cabal-sandbox/logs/happstack-server-7.4.6.1.log:

Building happstack-server-7.4.6.1...
Preprocessing library happstack-server-7.4.6.1...
[ 1 of 38] Compiling Happstack.Server.Internal.LazyLiner ( src/Happstack/Server/Internal/LazyLiner.hs, dist/dist-sandbox-925bc8f2/build/Happstack/Server/Internal/LazyLiner.o )
[ 2 of 38] Compiling Happstack.Server.Internal.SocketTH ( src/Happstack/Server/Internal/SocketTH.hs, dist/dist-sandbox-925bc8f2/build/Happstack/Server/Internal/SocketTH.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package zlib-0.6.1.1 ... linking ... done.
Loading package xhtml-3000.2.1 ... linking ... done.
Loading package utf8-string-0.3.8 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package old-time-1.1.0.2 ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package time-compat-0.1.0.3 ... linking ... done.
Loading package stm-2.4.4.1 ... linking ... done.
Loading package threads-0.5.1.3 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package binary-0.8.2.1 ... linking ... done.
Loading package text-1.2.2.0 ... linking ... done.
Loading package system-filepath-0.4.13.4 ... linking ... done.
Loading package syb-0.6 ... linking ... done.
Loading package unix-2.7.0.1 ... linking ... done.
Loading package network-2.6.2.1 ... linking ... done.
Loading package sendfile-0.7.9 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.3.1 ... linking ... done.
Loading package parsec-3.1.9 ... linking ... done.
Loading package network-uri-2.6.0.3 ... linking ... done.
Loading package transformers-compat-0.5.1.4 ... linking ... done.
Loading package transformers-base-0.4.4 ... linking ... done.
Loading package monad-control-1.0.0.5 ... linking ... done.
Loading package html-1.0.1.2 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package process-1.2.0.0 ... linking ... done.
Loading package hslogger-1.2.9 ... linking ... done.
Loading package extensible-exceptions-0.1.1.4 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package exceptions-0.8.2.1 ... linking ... done.
Loading package blaze-builder-0.4.0.1 ... linking ... done.
Loading package blaze-markup-0.7.0.3 ... linking ... done.
Loading package blaze-html-0.8.1.1 ... linking ... done.
Loading package base64-bytestring-1.0.0.1 ... linking ... done.

ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
  templatezmhaskell_LanguageziHaskellziTHziSyntax_zdfMonadQzuzdczgzgze_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  [email protected]

How can I fix this?

▶ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4

▶ cabal --version
cabal-install version 1.18.1.0
using version 1.18.1.5 of the Cabal library 

Solution

  • The problem was due to an older version of template-haskell installed by my OS package manager. This version was taken into account even though I work in a sandbox. I solved the issue by using cabal install --shadow-installed-packages.