Fix a compilation issue that occurs when using a different builddir with "cabal build --builddir=DIR", reported by Bit Connor (#23), Gregory Collins (#24) and Bas van Dijk (#25).