Friday, September 9, 2011

GHC 7.0.4 on CentOS

This is mainly a post for myself so that I can look back any time how I did it.

Basically I fell in every possible hole while wandering around in the dark but I could get out of them :-)
  • after downloading I configured the binary installation for x86-64. configure starts ghc-pwd, which is built with the wrong glibc-versions. Bummer.
  • found out that I have to get the source install. Downloaded and configured, it died in the middle because base-4.2 was not available. Bummer.
  • so I had to install ghc-6.12.3 first. Fortunately this went smoothly (binary install). With this new friend I reconfigured v7.0.4 and started building. When linking the stage1 compiler I got an error from binutils that some relocation went awry. Bummer.
  • the internets are full of hints that the system compiler (gcc-4.1) uses the bad linker. To my luck I found a new gcc-4.4 in an amicable colleague's home directory, so I reconfigured thus:
    ./configure --prefix=/home/gabor --with-gcc=/home/msichel/local_x86/bin/gcc
  • but configure told me that the shiny new gcc cannot build executables. Bummer.
  • it turned out (I had to write a hello-world to figure that out) that some gcc-internal shared libraries were not found. Luckily they came into scope with
    LD_LIBRARY_PATH=/home/msichel/local_x86/lib:/opt/lsf/6.2/linux2.6-glibc2.3-x86_64/lib
  • at this point I could smell victory, but it was still out of reach. A blog post suggested to cp mk/build.mk.sample mk/build.mk and edit it in two ways:
    • uncomment BuildFlavour = quick
    • and change to GhcLibWays = v p dyn, i.e. append "p dyn"
  • I did both, reconfigured and typed make install.
It went through without a hitch :-)