
Hi, This is my first time trying to compile GHC, so forgive me if these issues are mentioned somewhere. I couldn't find them anywhere on the wiki. 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. So this is why I decided to compile GHC from source in the first place. So I compiled GHC, and did make install, and I was _expecting_ that all of the library sources would end up in the directories alongside the binaries as well and that this is how the editor would be able to locate the source. But this did not happen, and instead my library folders look exactly like they do in the binary distribution that I installed by downloading the prepacked installer from the website. However, at one point I had downloaded some packages from Hackage and installed them with runhaskell configure, runhaskell build, runhaskell install on each of these new libraries, and the source did end up in the library directories alongside the binaries. So I feel like I'm doing something wrong in building GHC, and that when I install there should be a way to have the source of the libraries copied to the target directories. Can someone elaborate on how this is supposed to work for other programs that depend on the library sources to be able to find them? I know that of the 2 Hackage packages that I installed, the editor printed a message saying that it did find source for those two, but not for any other libraries. 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. 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". 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. Last, after building GHC when I go to run make install, I want the target location to be the original location of the compiler that I used to build GHC in the beginning. In other words, I want to have it overwrite the old version of GHC instead of going to the default install location under /usr/bin, etc... How can I specify the target install location?

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: http://hackage.haskell.org/trac/ghc/ticket/2630 http://hackage.haskell.org/trac/hackage/ticket/364 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: http://darcs.haskell.org/buildbot/ (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 http://hackage.haskell.org/trac/ghc/wiki/Building 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!-) Claus

On Sun, Mar 29, 2009 at 5:35 PM, Claus Reinke
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:
http://hackage.haskell.org/trac/ghc/ticket/2630 http://hackage.haskell.org/trac/hackage/ticket/364
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.
I see, so I guess the short answer is "there's just no easy way to do it for now". Perhaps I'll write a Perl script that will do it for me while waiting for a standardized solution. The issue of source/binary version mismatches shouldn't be a problem as long as the source I copy over is the same source I built from right? Or are you suggesting that sometimes the source is transformed during the build process before being compiled?
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:
http://darcs.haskell.org/buildbot/
(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.
I'm pretty sure I'm NOT configured for MinGW when I was trying to build under Cygwin. I just assumed that the process would be completely independent of the mingw process. What do I need to do configure the cygwin environment for MinGW?
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 http://hackage.haskell.org/trac/ghc/wiki/Building
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!-)
Is there a way to download a windows binary distribution of GCC myself and have Cygwin use my version of GCC and Cygwin's version of all tools? It just seems a little superfluous to have two unix environments (Cygwin and mingw) and two separate copies of GCC installed (since I already use windows GCC for other reasons)

I see, so I guess the short answer is "there's just no easy way to do it for now". Perhaps I'll write a Perl script that will do it for me while waiting for a standardized solution. The issue of source/binary version mismatches shouldn't be a problem as long as the source I copy over is the same source I built from right? Or are you suggesting that sometimes the source is transformed during the build process before being compiled?
It isn't just a matter of scripting (you could 'cabal unpack' all your installed packages somewhere), but of source code interpretation being partially package-based (eg, if you have two packages providing alternative implementations of the same modules, it is cabal's job to organize the hiding of one while building or using the other; if you just use ghc's import chasing over a list of import directories containing the sources of both packages, things are likely to fail). If you keep the sources around from the build, at least all the preprocessing and configuration will have been done and match the installed binaries. If you get something working (for which editor, btw?), you might want to add your experiences to one of those tickets, or the wiki. It isn't that this would be impossible, just not trivial, so we have to keep adding information on possible solutions/issues until a viable design for a standard solution emerges.
Are you sure you've configured for mingw? Otherwise the build system will try to proceed in cygwin, as if for a unix platform.
I'm pretty sure I'm NOT configured for MinGW when I was trying to build under Cygwin. I just assumed that the process would be completely independent of the mingw process. What do I need to do configure the cygwin environment for MinGW?
Not configure cygwin, but configure the ghc build (so that it will pick up mingw gcc/ld even while using cygwin sh/make/configure). See wiki:Building for details.
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 http://hackage.haskell.org/trac/ghc/wiki/Building
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!-)
Is there a way to download a windows binary distribution of GCC myself and have Cygwin use my version of GCC and Cygwin's version of all tools? It just seems a little superfluous to have two unix environments (Cygwin and mingw) and two separate copies of GCC installed (since I already use windows GCC for other reasons)
mingw is a windows binary distribution of gcc/ld/.. (which create windows-native executables) - you need this. msys and cygwin are unix-like environments (sh/make/configure/ ..) - you need exacty one of these. cygwin has its own versions of gcc/ld (which generate cygwin-dependent executables*) - you don't need these (not likely to work for ghc builds). Most of which I mentioned before, as does the wiki. Claus *cygwin's gcc/ld used to have a native mode, but the sources for that may not be in sync with the now separate mingw gcc/ld, may not do the same thing, and are not likely to work for ghc builds
participants (2)
-
Claus Reinke
-
Zachary Turner