mixing x86_64 and i386

John Meacham john at repetae.net
Sun Aug 7 05:15:11 EDT 2005


Just thought I'd share a little hack...

linux has a command 'setarch' which changes the current architecture so
you can do things like build i386 rpms on a x86_64 system...

by installing both a i386 and x86_64 ghc (both from the fedora repo work
great) and replacing the ghc driver with something like the below makes
ghc "just work" too. (replace paths as appropriate)

I wonder if we should make the driver script a bit smarter in general to
allow multiple versions of ghc normally so you can just pass a version
and arch command line argument to ghc and the driver will intpret it and
call the appropriate back end.

#!/bin/sh

case `uname -m` in            
    x86_64)
    GHCBIN="/usr/lib64/ghc-6.4.1.20050626/ghc-6.4.1.20050626"
    TOPDIROPT="-B/usr/lib64/ghc-6.4.1.20050626"
    EXTRA_OPTS="" ;;
    i*86)
    GHCBIN="/usr/lib/ghc-6.4/ghc-6.4"
    TOPDIROPT="-B/usr/lib/ghc-6.4" 
    EXTRA_OPTS=" -optc-m32 -optl-m32 -opta-m32 " ;;
    *)
    echo "Unknown architecture" ; exit 2;;
esac

echo $GHCBIN $TOPDIROPT $EXTRA_OPTS ${1+"$@"}
exec $GHCBIN $TOPDIROPT $EXTRA_OPTS ${1+"$@"}

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Glasgow-haskell-users mailing list