Re: ocaml cross-compilation and bootable image

From: Xavier Leroy (Xavier.Leroy@inria.fr)
Date: Tue Mar 02 1999 - 12:05:36 MET


Date: Tue, 2 Mar 1999 12:05:36 +0100
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Dave Mason <dmason@sarg.Ryerson.CA>, caml-list@inria.fr
Subject: Re: ocaml cross-compilation and bootable image
In-Reply-To: <199902271817.NAA15408@sarg.Ryerson.CA>; from Dave Mason on Sat, Feb 27, 1999 at 01:17:32PM -0500

> I'm running ocamlopt on an Alpha (Linux) but need to generate i386
> binary executables.
> Has anyone done this? Any hints on how to do it?

I never tried to set up a full cross-compiler, but it should not be
hard. You need to run the configure script, then edit the generated
file config/Makefile and change the following variables:

ARCH=<your target architecture, e.g. i386>
MODEL=default
SYSTEM=<your target OS (for choosing calling conventions, etc), e.g. linux_elf>
NATIVECC=<your cross C compiler, e.g. myarch-gcc>
NATIVECCCOMPOPTS=<whatever options you need at compile-time>
NATIVECCLINKOPTS=<whatever options you need at link-time>
ASPP=<your cross assembler with preprocessing, e.g. myarch-gcc>
ASPPFLAGS=-c -DSYS_$(SYSTEM) <extra options if needed>

Finally, the name of the assembler called to assemble the output of
ocamlopt is (unfortunately) hard-wired in asmcomp/<arch>/proc.ml,
function assemble_file, so you may need to change that file.
Or just play with $PATH until "as" refers to your cross-assembler.

There's also a hard-wired call to "ar" in utils/ccomp.ml that may need
to be changed.

Good luck,

- Xavier Leroy



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:20 MET