When I try  cabal-install lambdabot (gentoo linux/amd64, ghc installed with portage), it runs fine until compiler tries to link readline package (some template haskell?). The problem caused by dirty trick, used in gentoo: the /usr/lib64/libreadline is a fake with script, redirecting ld to /lib64 . GHC is not redirected but simply fails with message  "can't load .so/.DLL for: readline (/usr/lib64/libreadline.so: invalid ELF header)".

So, the question is: is there any workaround? Copying library look like an option, but it is very, very dirty one. Is there a way to say ghc, which libreadline.so it should  load?