Skip to content

hsc2hs cannot find headers from include dir

Summary

Trying to run hsc2hs and including ghcversion.h or ghcplatform.h fails with:

error: ./Foo_hsc_make.c:2:10: fatal error: ghcplatform.h: No such file or directory
    2 | #include "ghcplatform.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.

Steps to reproduce

  1. download a binary distribution
  2. unpack the tarball
  3. ./configure --prefix=/ghc945
  4. make install
  5. touch Foo.hsc
  6. /ghc945/bin/hsc2hs -ighcplatform.h -ighcversion.h Foo.hsc

Expected behavior

hsc2hs should be able to find the headers from the includedir.

Looking into the generated hsc2hs wrapper script, it has:

!/bin/bash
exedir="/ghc945/lib/bin"
exeprog="./hsc2hs-ghc-9.4.5"
executablename="/ghc945/lib/bin/./hsc2hs-ghc-9.4.5"
bindir="/ghc945/bin"
libdir="/ghc945/lib/lib"
docdir="/ghc945/doc"
includedir="/ghc945/include"

But the includedir directory does not exist. However, there is an include directory present in the tarball, and when I cp -r ~/bindist_unpacked/include/ /ghc945/ it starts to work.

Environment

  • GHC version used: 9.4.5

Optional:

  • Operating System: linux
  • System Architecture: amd64
Edited by Claudio Bley
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information