[MLton] self-compiling failed

Baojian Hua huabj at mail.ustc.edu.cn
Wed May 19 20:03:30 PDT 2010




> -----Original E-mail-----
> From: "Matthew Fluet" <matthew.fluet at gmail.com>
> Sent Time: 2010-5-19 21:51:36
> To: "Baojian Hua" <huabj at mail.ustc.edu.cn>
> Cc: mlton <mlton at mlton.org>
> Subject: Re: Re: [MLton] self-compiling failed
> 
> On Wed, May 19, 2010 at 9:22 AM, Baojian Hua <huabj at mail.ustc.edu.cn> wrote:
> > And the document at
> > http://mlton.org/SelfCompiling
> > seems a little out-of-date and not very informative for this.
> 
> Yes, I glanced at that when you mentioned your difficulties, and agree
> that it should be updated.
> 
> > Btw: I'm trying to self-compile MLton for that I'm trying to implement
> > some new optimizations on SSA IL. In this, I've found that the MLton's
> > expert option "-trace" won't work as I expected (it produce nothing).
> > A close look at the code reveals that the Assert.debug is set to false, so
> > it seems that I should set it and then build a "tracable" version. Is this
> > the perfect way to do this? Or else is there another option to control this?
> 
> There are two ways to enable the "-trace" option.
> 
> It is enabled under a SML/NJ build of MLton.  From the root of the
> mlton source tree, a "make smlnj-mlton" will build a SML/NJ heap image
> and copy it to build/lib.  The build/bin/mlton script will prefer a
> MLton build of MLton over a SML/NJ build of MLton, so be sure to
> remove build/lib/mlton-compile.  Because SML/NJ's cutoff recompilation
> is faster than MLton's whole program compilation, this is generally
> the way I work when debugging something like an SSA IL optimization
> pass.
> 
And if we intall the new "mlton-smlnj.x86-linux" in /usr/bin/mlton/, and
run mlton script:
$ mlton
but got this error message: (part of it)

de=d' -target-link-opt darwin ' -L/usr/local/lib' -target-link-opt freebsd -L/usr/local/lib/ -target-link-opt aix -maix64 -target-link-opt ia64 '' -target-link-opt mingw '-lws2_32 -lkernel32 -lpsapi -lnetapi32 -lwinmm' -target-link-opt mingw -Wl,--enable-stdcall-fixup -target-link-opt netbsd '-Wl,-R/usr/pkg/lib -L/usr/pkg/lib/' -target-link-opt openbsd -L/usr/local/lib/ -target-link-opt solaris '-lnsl -lsocket -lrt' -target-link-opt x86 -m32 -profile-exclude '\$\(SML_LIB\)'
unknown switch: -fno-common
usage: mlton [option ...] file.{c|cm|mlb|o|sml} [file.{c|o|s|S} ...]
    -align {4|8}                    object alignment
    -as-opt <opt>                   pass option to assembler
    -cc-opt <opt>                   pass option to C compiler
    -codegen {native|x86|c}         which code generator to use
    -const '<name> <value>'         set compile-time constant
    -default-ann <ann>              set annotation default for mlb files
    -default-type '<ty><N>'         set default type
    -disable-ann <ann>              disable annotation in mlb files

Are we missing something else?

> It is also enabled under a MLton build of MLton that uses "-const
> 'MLton.debug true'".  From the root of the mlton source tree, a "make
> traced" will build such a compiler.  (This target to the root Makefile
> doesn't build everything, so you should only use it after having first
> done a "make".)  Then the build/bin/mlton.trace script will invoke the
> mlton-compile.trace executable that has the "-trace" option enabled.
> This build also enables exception histories, which is often useful for
> debugging.




More information about the MLton mailing list