A quick follow-up<br><br><div class="gmail_quote">2011/10/13 Michael Lazarev <span dir="ltr"><<a href="mailto:lazarev.michael@gmail.com">lazarev.michael@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I used x64 edition of Ubuntu 11.10 for a while, and was able to run both 64-bit and 32-bit GHCs.<br>Both GHCs were manually set-up (i.e. download; tar xvjf ...; ./configure --prefix=...; make install)<br>
All is needed is to install both versions of libgmp by "apt-get install libgmp3-dev lib32gmp-dev"<br><br>32-bit version runs ghci fine, but I actually cannot compile stuff with it.<br></blockquote></div><br>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.<br>
<br><br>Complete example:<br><br>----------------------------------------------------------------------<br><br>$ sudo apt-get install lib32gmp-dev g++multilib<br><br>$ cat ./Test.hs <br>module Main where<br><br>import Control.Monad<br>
<br>getR :: Read r => IO r<br>getR = liftM read getLine<br><br>main = liftM2 (+) getR getR >>= print<br><br><br>$ /home/ml/local/ghc/7.0.4-32/bin/ghc --make ./Test.hs -opta -m32 -optl -m32<br>Linking Test ...<br>
<br>$ file ./Test<br>./Test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped<br><br>----------------------------------------------------------------------<br>
<br><br>Hope that helps.<br>It is also interesting to find out how that works with "cabal build" command.<br><br>