[MLton] Re: cygwoes

Andrew Kennedy akenn@microsoft.com
Tue, 11 Oct 2005 14:58:55 +0100


Got it. Didn't realize that the .S and .c outputs of the mlton compiler
were both required (thought that one was the assembly of the other). 

For what it's worth, in case there are other mlton/cygwin novices on
this list, I did the following successful compilation:

mlton -stop g hello.sml

gcc -o hello -I/usr/lib/mlton/include -L/usr/lib/mlton/self
-L/usr/local/lib -O1 hello.*.S hello.*.c -lmlton -lgmp -lgdtoa -lm

Thanks
Andrew.


-----Original Message-----
From: Matthew Fluet [mailto:fluet@cs.cornell.edu] 
Sent: 11 October 2005 14:28
To: Andrew Kennedy
Cc: MLton@mlton.org
Subject: RE: [MLton] Re: cygwoes


> Thanks Matthew. For the link step I get
>
> Undefined reference to `_F_0'
>
> Any idea what this might be?

I think it is related to the fact that Cygwin/MinGW add an extra "_" to 
the beginning of assembly labels.  (The label "F_0" normally corresponds

to the label we assign to the top-level evaluation of the SML program.)

We're supposed to handle the extra "_" by recognizing the target OS and 
compensating in the codegen.  I could imagine that this becomes 
problematic if you built in a way that mis-specified/inferred the target

OS.  Could you give any more info on how you built the .c and .S files?

> -----Original Message-----
> From: Matthew Fluet [mailto:fluet@cs.cornell.edu]
> Sent: 11 October 2005 14:00
> To: Andrew Kennedy
> Cc: MLton@mlton.org
> Subject: Re: [MLton] Re: cygwoes
>
>
>>> As another stopgap, you could use mlton -stop g and then call gcc by
>>> hand, since that works for you.
>>>
>> Please let me know what options I should pass to gcc for a successful
> build.
>
> Something like
>
>  gcc -c -Ibuild/lib/include -O1 -w mlton/mlton.*.[cS]
>  gcc -o build/lib/mlton-compile \
>         -Lbuild/lib/self \
>         -L/usr/local/lib \
>         mlton.*.o \
>         -lmlton -lgmp -lgdtoa -lm
>
> which is documented on the PortingMLton page:
>   http://mlton.org/PortingMLton
>
>
> I did a little more investigating of the Virtual{Alloc,Free} problems
> over
> the weekend, and I'm mostly convinced that (at least through Cygwin),
> they
> are not working as advertised by the API.  I've got more info at home
> that
> I'll try to post this evening.
>
> _______________________________________________
> MLton mailing list
> MLton@mlton.org
> http://mlton.org/mailman/listinfo/mlton
>