Sunday, October 17, 2010

Install Haskell environment on Gentoo

I just installed Haskell environment (ghc 6.12.3) on a Gentoo Linux system(2.6.31-gentoo-r10). Since the package system of Gentoo is not quite compatible with cabal, I choose to install the binary version of ghc and then use cabal to install everything else. The first problem is a complain going like this: "gtk2hsC2hs is required but it could not be found". It turns out that we need to cabal install gtk2hs-buildtools before moving on.

Another complain repetitively made by cabal is "can't load .so/.DLL for: readline (/usr/lib/libreadline.so: invalid ELF header)", easily reproducible by issuing "ghci -package readline". After some investigation, it turns out to be due to a Gentoo policy.

To work around the problem, I assumed root privilege to use the following script, which basically restores libraries under /usr/lib/ to be true ELF files instead of symbolic links.

#!/bin/env python
import os
cmd = "mv /usr/lib/lib%s.so{,.old};ln -s /lib/lib%s.so"%(i,i)
for i in ["ncurses","ncursesw","readline","z"]:os.system (cmd)

No comments:

Post a Comment