I have been trying to install Haskell Platform and cabal-install
installed on Linux in user-space on a system that doesn't have the GNU Multi-Precision package (GMP) installed.
I managed to get GHC-6.12.1 installed and GHCi working by setting up LB_LIBRARY_PATH
to point at the lib directory where I installed GMP, but then ran into problems in the next step, getting cabal-install
to work. It kept trying to (statically) link to GMP.
This fails because the GMP is not installed in the system and ld
hasn't a clue where to find the libraries, and there is no environment variable (that I am aware of) that can tell ld where to find the user-installed GMP, and (apparently) no way of telling configuring Cabal to supply the relevant -L
flag.
After much fruitless searching and hacking attempts I hit on the absurdly simple idea of installing my own ld
shell script that invokes the system ld
with the appropriate -L
flag.
This is shell scripting 101, of course:
#!/bin/sh
/usr/bin/ld -L$HOME/gnu/lib "$@"
With this script installed in a directory on my PATH
ahead of /usr/bin
all the problems seem to have gone away.