Few problems with building GHC

Claus Reinke claus.reinke at talk21.com
Sun Mar 29 18:35:24 EDT 2009

I was going to suggest following the source links in the Haddock pages,
until I saw your motivation:

> First, I had originally installed a binary distribution and then tried to
> compile another program (a Haskell editor) that recommended I have source
> available for all libraries, since it would be able to give me better info
> in the editor.  

That is a typical problem for source-based programming tools
in a ghc/cabal-based programming environment. I'm not aware
of a standardized solution yet. 

Some tools get away with the information the GHC Api provides 
about compiled packages, eg editors/IDEs usually only need the 
types and haddocks of the exported identifiers; some tools require 
their own additional info to be built for each package, eg profiling/
haddock; some tools would really like to get access to the source 
for installed packages, eg program transformation tools that want 
to unfold definitions across package boundaries.

Getting the source that actually matches the installed binaries is
not straightforward (unrecorded compilation options). Sometimes,
one "accurate in spirit" version of the source might be sufficient
independent of the details of the installed binary packages. There 
are tickets pending, with discussion of the issues:


Also, Cabal has recently acquired an 'unpack' command, which
allows to unpack the source for a package into a local directory.

But someone still needs to connect the pieces, either for each
tool, or for a common framework that all source-dependent
tools could use.

> Second, I cannot create a windows build of GHC under cygwin.  Looking 
> at the Building Guide on the wiki suggests that this is indeed supported.  

Personally, I last built the head version

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.11.20090320

that way. The buildbots seem to succeed most of the time recently,
with some recent issues in stable:


(whenever windows head/stable builds there, it is a good time to 
pull patches;-)

> However, when I try to build it I get
> cabal-bin.exe: Cannot find the program 'ghc' at
> '/cygdrive/c/dev/haskell/ghc/ghc-6.10.1/bin/ghc' or on the path
> make[1]: *** [bootstrapping.conf] Error 1
> make[1]: Leaving directory
> `/cygdrive/c/dev/haskell/ghc/ghc-6.10.1-src/libraries'
> make: *** [stage1] Error 2
> There seems to be some unix/windows confusion here, because it's looking for
> an executable file named "ghc", when the actual executable name is
> "ghc.exe".  

Not just that. Cabal is also trying to find ghc via a cygwin path
(about which ghc-compiled binaries like Cabal don't know a thing).

Are you sure you've configured for mingw? Otherwise the build
system will try to proceed in cygwin, as if for a unix platform.

>However, building under MSYS everything works perfectly.  Is
> Cygwin just not supported, or do I need to change something here?  I don't
> see any point in cluttering up my system with tons of extra software like
> MinGW, msys, etc if Cygwin works fine.

Mingw provides the C compiler, msys or cygwin the build tools.
Even under cygwin, you still need to configure to use the mingw
C compiler and linker (not the cygwin versions of these).

Simon Marlow has recently cleaned up the build instructions

If there's still anything missing or ambiguous in there, please provide 
details, questions, or improve the wiki pages. We all like those
instructions to be accurate, for the next time we start from scratch!-)

More information about the Glasgow-haskell-users mailing list