
A quick follow-up
2011/10/13 Michael Lazarev
I used x64 edition of Ubuntu 11.10 for a while, and was able to run both 64-bit and 32-bit GHCs. Both GHCs were manually set-up (i.e. download; tar xvjf ...; ./configure --prefix=...; make install) All is needed is to install both versions of libgmp by "apt-get install libgmp3-dev lib32gmp-dev"
32-bit version runs ghci fine, but I actually cannot compile stuff with it.
It turns out that it is also possible to compile a 32-bit executable by 32-bit ghc under Ubuntu 11.10 x64. First, additional files supporting compilation for different architectures in gcc must be installed by "sudo apt-get install g++multilib". Second, one need to pass additional arguments to ghc: "-opta -m32 -optl -m32". They are, in turn, passed to gcc assembler and linker, respectively, telling them to build for 32-bit architecture. Complete example: ---------------------------------------------------------------------- $ sudo apt-get install lib32gmp-dev g++multilib $ cat ./Test.hs module Main where import Control.Monad getR :: Read r => IO r getR = liftM read getLine main = liftM2 (+) getR getR >>= print $ /home/ml/local/ghc/7.0.4-32/bin/ghc --make ./Test.hs -opta -m32 -optl -m32 Linking Test ... $ file ./Test ./Test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped ---------------------------------------------------------------------- Hope that helps. It is also interesting to find out how that works with "cabal build" command.