Skip to content

Installation Troubleshooting

Stavros Chryselis edited this page Dec 29, 2017 · 10 revisions

Cabal build errors

The trickiest part of the installation is building the shared binaries like codex and ghc-mod. Although the installer builds them each in their own Cabal sandbox it can run into problems if there are too many packages installed globally. Global packages are shared with sandboxes and affect the Cabal planner.

To see what packages you have installed, run ghc-pkg list. You shouldn't have more than these base packages installed globally:

Cabal, array, base, bin-package-db, binary, bytestring, containers, 
deepseq, directory, filepath, ghc, ghc-prim, haskell2010, haskell98, 
hoopl, hpc, integer-gmp, old-locale, old-time, pretty, process, rts, 
template haskell, time, transformers, unix

If you have others, get rid of them with ghc-pkg unregister.

Stalled installation

If the installation stops while building ghc-mod and uses the CPU but makes no progress then you're probably running it with too little memory. If you're using a virtual machine try bumping the memory to at least two gigabytes for the duration of the installation. If you cannot control the available memory, try creating a swap file as discussed here.

Vim can't infer any types

Vim uses ghc-mod to analyze types in your source files. This relies on your project being built with Cabal's --enable-test flag. You may need to recreate your sandbox and rebuild with this option.

The type highlighting is misplaced

This can happen if your source file uses tab indenting. The ghc-mod helper has its own idea of tab width and reports a specific character range for Vim to highlight. The solution is to either indent with spaces, or adjust your Vim tab width.

OSX Yosemite using homebrew

"need exuberant ctags"
"program 'happy' version >=1.17 is required"
"ERROR: cannot verify www.haskell.org's certificate"

Installing on OSX Yosemite (10.10.1) with XCode 6.1.1 and ghc, cabal-install and vim installed from homebrew had three issues for me, both can be addressed before attempting install. If you're doing a fresh install the haskell-vim-now installer will pull down and build a lot of haskell programs, you'll need to be patient.

Problem 1: the ctags included in XCode lacks exuberance:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ctags: illegal option -- -
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
--- Requires exuberant ctags, not just ctags. Aborting.

Problem 2: cabal can't build haskell-src-exts-1.16.0.1, it's un-happy:

Failed to install haskell-src-exts-1.16.0.1
setup-Simple-Cabal-1.20.0.2-x86_64-osx-ghc-7.8.3: The program 'happy' version >=1.17 is required but it could not be found.

Problem 3: wget (called by hoogle) complains about haskell.org's certificate

Downloading downloads/base.txt
# base.txt (for downloads/base.txt)
ERROR: cannot verify www.haskell.org's certificate, issued by '/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domainn Validation CA - SHA256 - G2':
  Issued certificate has expired.
To connect to www.haskell.org insecurely, use `--no-check-certificate'.

Avoid issues 1 & 2 by pre-installing these items:

$ brew install ctags
 [...]
/usr/local/Cellar/ctags/5.8: 8 files, 364K, built in 16 seconds
$ cabal install happy
 [...]
Installed happy-1.19.4

Issue 3 has something to do with wget versions, apparently. Temporary fix is to tell wget not to check certificates by adding this line to your ~/.wgetrc file (don't leave it in this slack mode):

check_certificate = off

When ready run (or re-run) the install script as per install instructions.

You can re-run just the final the hoogle database build with:

$ ~/.haskell-vim-now/bin/hoogle data

Remember to return your ~/.wgetrc file to its normal state.

Using stack

stack install ghc-mod is a quick and easy alternative for installing ghc-mod