[Haskell-cafe] Cross-compilation x64 -> x86 easier under Ubuntu 11.10 with multiarch?
Joachim Breitner
mail at joachim-breitner.de
Thu Oct 13 22:20:16 CEST 2011
Hi,
Am Donnerstag, den 13.10.2011, 22:26 +0400 schrieb Michael Lazarev:
> 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
>
> ----------------------------------------------------------------------
Did you build the boot libraries and possible ghc also with these flags?
Greetings,
Joachim
--
Joachim "nomeata" Breitner
mail at joachim-breitner.de | nomeata at debian.org | GPG: 0x4743206C
xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111013/4373f704/attachment.pgp>
More information about the Haskell-Cafe
mailing list