Cygwin cross compiler

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Thu, 14 Mar 2002 09:50:09 -0500 (EST)


> OK - I changed that to 1 and now gc.c is compiled. However I also had
> to do some tweaking before I could install the runtime - copying
> runtime/*.h
> and include/*.h myself. But that still only installs the headers
> correctly.
> The .a files are apparently not built by doing this. When I do a
> make runtime in the mlton-20020312 directory I have to make a copy of my
> /usr/local/bin/mlton to build/bin/mlton before it works at all - and
> then
> get the following complaint in the end:
> invalid switch: -build-constants
> 
> Before doing any of this I also installed the latest stable binaries
> from
> your website (20011006).

Right; this won't work.  There's some serious funkiness in the way the
system is bootstrapping right now.  In theory, it works as follows:

make the build directories (src/build/bin src/build/lib 
	src/build/lib/$(HOST) src/build/lib/$(HOST)/include)
make the compiler executable, using whatever mlton is in your path
	(in theory, this is the currently installed mlton; but, as you
	discovered mlton-20011106 is too "out of date" to compile the
	current sources, so you need to build with the binaries in the
	RPM)
make the compiler script (src/build/bin/mlton) which simply means setting
	the right path and make the world (i.e., pre-processed basis-library)
now, we have an compiler executable ready to go, just no runtime with
	which to link the programs the compiler compiles; so next is to
	build the runtime
the runtime is dependent upon the host on which you wan the final
	executables to run; in particular, we need to extract from the
	basis-library all of the host-dependent constants; that's the
	-build-constants option; in practice, we build libmlton.a (just
	like before) and move the headers to src/build/lib/$(HOST)/inlcude;
	then, run the "new" mlton with -build-constants to get a .c file
        with the constants; compile that .c file, run it to produce
        the constants map
after this, the default makefile goes ahead and compiles mllex, mlyacc,
	and mlprof

> So, ehm - any hints? :)

Best is to really use the binaries that are in the experimental RPMS;
I built new binary and source rpms based on the current sources, so the
binaries from these should work "out of the box" on a 2.2 kernel.
The only outstanding issue that I know of is that if you try to compile
the runtime (in particular, gc.c) on a 2.2 kernel, you need to remove the
reference to sbuf.mem_unit.

Anoq, if you see this before Steve and Henry get a chance to update the
rpms on the MLton website, you can grab the new ones from
www.cs.cornell.edu/People/fluet/MLton.