[Haskell-cafe] Re: [Haskell] hsc2hs can't find gcc under windows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Dec 26 14:09:03 EST 2008


On Thu, 2008-12-25 at 15:17 +0900, Curt Sampson wrote:
> I'm trying to upgrade from ghc 6.8.3 to 6.10.1. Unfortunately, there
> seem to be problems with the Windows version. (I've installed it on
> two different machines, both Windows XP, and they've both had the same
> problem. Both worked fine with 6.8.3.)
> 
> When I run hsc2hs, on an hsc file, I get the error, "Can't find gcc".
> 
> Just as an experiment, I tried adding c:\ghc\ghc-6.10.1 to my path. That
> lets it find gcc, but then it can't find cc1. If I go even further down
> this road and add c:\ghc\ghc-6.10.1\gcc-lib to my path, it can find cc1,
> but then I get a stream of errors about not being able to find header
> files, such as HsFFI.h.
> 
> Does anybody have any clues here to help me? I can provide code, or even
> access to the machine, if needed.

So here's the story:

Up until ghc-6.10, ghc shipped a fork of hsc2hs. The forked version used
ghc as the C compiler rather than gcc. This had the advantage that it
would know about ghc packages and the include files shipped with
packages. The disadvantage was that it was a fork and behaved
differently than using hsc2hs with hugs. It also meant that real C
compiler options had to be double-escaped to get hsc2hs to pass them to
ghc and get ghc to pass them to gcc.

In ghc-6.10, ghc ships the normal hsc2hs. What we did not notice before
6.10.1 was released was that calling hsc2hs on its own now does not work
without passing additional flags. We never noticed because few people
actually do call hsc2hs directly, it is typically used via Cabal. Cabal
tells it where gcc lives and what include dirs to use.

So that's why at the moment in the Windows installer, hsc2hs cannot even
find gcc, because gcc is not on the %PATH% and hsc2hs does not know
about ghc's special bundled version of gcc. It also does not know about
ghc's include directories.

It's clear we'll need to think a bit more about how to get hsc2hs to be
both a compiler neutral tool where we can share a single instance
between multiple compilers and also have it work "out of the box".

> We're also happy to pay for support, if someone out there is offering
> commercial support for ghc.

We offer commercial support through Well-Typed:
http://www.well-typed.com/


Duncan



More information about the Haskell-Cafe mailing list