Compiling for Sparc v9 / Solaris 8 using 64-Bit!
Donald Bruce Stewart
dons at cse.unsw.edu.au
Wed Apr 28 00:55:44 EDT 2004
> Dear all,
> I would like to compile my haskell-scripts on a Sparc v9 / Solaris 8
> machine using 64-Bit, cause of insufficient memory using 32-Bit.
> GHC is installed on this machine and works fine. The Problem is, that it
> only produces 32-Bit binaries.
> Checking the GHC manual and the web didn't deliver me the solution how
> to get GHC to compile for 64-Bit.
> I just got some hints that it should work, but not how.
> Has anyone an idea?
I don't know the exact details of Solaris, but it may be similar to the
mips64/irix. mips64/irix lets you run either 32 and 64 bit binaries on
If this sounds like what you are trying to do, then read on...
Building GHC as a 32 bit port didn't work for some reason, 64 bits did work.
You would need to port GHC to run in 64 bit world, following:
The main problem is making sure the tools you need are all passed the
correct flags to trigger 64 bit mode results. This, in the mips64 case,
involves setting some environment vars, and some flags. You need to read
man pages for cc, ld, and the binary format probably. They're all
Environment stuff I had to set up the C tools to produce 64 bits:
export LD="/usr/bin/ld -64"
And we have to tell GHC to pass flags through to gcc, the assembler and the
linker when bootstrapping from .hc files:
SRC_HC_OPTS+=-optc-mabi=64 -opta-mabi=64 -optl-mabi=64
Once this was all in place, you could run ./configure and it would give
you 8 byte longs. You can use the config files generated to build some
.hc src on another machine, following the bootstrap instructions, and
then bring them back and continue the bootstrap.
You should generate a 64 bit GHC, that thinks it is on a 64 bit machine.
Still one last problem: GHC *also* needs to pass the 64 bit flags when
it is compiling its own Haskell binaries. Use the package system! I had
to patch fptools/ghc/rts/package.conf.in with:
@@ -63,9 +67,15 @@
c_includes = [ "Stg.h" ],
package_deps = ,
+ extra_ghc_opts = ["-opta-mabi=64"],
extra_ghc_opts = ,
#if defined(THREADED_RTS) && defined(freebsd_TARGET_OS)
extra_cc_opts = [ "-pthread" ],
+ extra_cc_opts = ["-mabi=64"],
And that's it. So it is harder than a normal .hc bootstrap, because
tools don't like to behave, and keep dropping back to 32 bit mode.
More information about the Glasgow-haskell-users