9

And why? There is a bootstrap process and compiling the real compiler process, but which part consumes the most time?

Don Stewart
  • 137,316
  • 36
  • 365
  • 468
hampurter
  • 91
  • 1
  • 2
  • 4
    You know you can download a pre-built compiler and set of libraries for OS X? http://hackage.haskell.org/platform/mac.html – Tim Robinson Jun 30 '10 at 20:40
  • I understand there are problems with interop between the pre-built versioni and Macports. – hampurter Jun 30 '10 at 20:56
  • OK, I haven't needed anything Haskell-related from Macports. The platform installer and Cabal have been enough. – Tim Robinson Jun 30 '10 at 21:32
  • 1
    Hadn't you heard? Computers are so fast now that compiler speed doesn't matter any more. – Crashworks Jun 30 '10 at 21:43
  • 1
    @Tim Robinson: Weird. For me the "Haskell Platform"'s system doesn't work. see http://stackoverflow.com/questions/3119782/mysterious-cabal-install-problems – yairchu Jun 30 '10 at 22:32

4 Answers4

9

From the Gentoo perspective:

In Gentoo, everything is compiled. What we do for GHC is that us devs (including unofficial devs like myself) compile a new version of GHC from an older one to create a binary bootstrapping version, and then package that up and let users use that one to compile a new version.

From memory, compiling the binary can take more than twice as long (takes about 45 minutes to use the binary to compile a new version on my laptop). There are some differences (the documentation is built and shipped with the binary rather than each user building it themselves) but none that I can see to account for such a large time difference. The actual ebuild used to build both the binary and for end users can be found here (enabling the ghcbootstrap flag means it builds a binary, enabling the binary flag means that users install and use the prebuilt binary rather than building GHC themselves): http://code.haskell.org/gentoo/gentoo-haskell/dev-lang/ghc/ghc-6.12.3.ebuild

As such, my guess is that it's the initial bootstrapping process that takes so long if Macports is indeed building an initial bootstrapping binary (especially if it's doing so from the last C-only release and bootstrapping its way up to the version you actually want to install).

ivanm
  • 3,927
  • 22
  • 29
5

Building GHC is notorious for taking forever. I've heard horror stories about it taking in excess of 8 hours for a from-source build. From what I understand, it is mainly due to the fact that the default build of GHC attempts to do massive amounts of optimization in order to speed its own runtime performance. Even with a partially prebuilt system (which is what I believe macports provides) this process still can take a while because of all the linking.

EDIT: See the following http://hackage.haskell.org/trac/ghc/wiki/Building/Using#HowtomakeGHCbuildquickly

  • This is the correct response: GHC that takes longer to compile then any software I know. I have been building it for over 8 hours on my i3. – Mikhail May 20 '13 at 20:48
4

It can take a while. When I used to compile it on my iBook G4, it took as long as 7 hours. Even on a MacBook Pro with plenty of RAM and a fast processor, it can take 2-3 hours.

mipadi
  • 398,885
  • 90
  • 523
  • 479
2

Some build processes take quite a while, and the amount of time depends strongly on the speed of your CPU and how much processor time can be devoted to the build.

If you're worried that it may be hanging in at a certain point, run install with the -v flag to get more descriptive output relating to the build process. The command would thus be something like:

sudo port -v install [portfile]
nearlymonolith
  • 946
  • 4
  • 7
  • 1
    As well as how large and complex the project is, what type of hard drive the box is using, etc. – NotMe Jun 30 '10 at 21:26
  • Right - I was being quite general, but of course the size of the project, number of files, which compiler/build utility is being used, number of dependencies, read/write speed, etc. all contribute to the length of time required. – nearlymonolith Jul 01 '10 at 15:28