Re: Re: Re: Re: self-compiling failed

Matthew Fluet <[email protected]>
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <[email protected]>
On Fri, May 21, 2010 at 2:37 AM, Baojian Hua <[email protected]> wrote:
>> Actually, you would need to install it in /usr/lib/mlton/.  Also, note
>> that you can't generally replace the mlton-compile executable (or
>> mlton-smlnj.x86-linux heap) from one version of the compiler with
>> another version, since the runtime library, basis library, etc. may
>> have also changed.  If /usr/bin/mlton and /usr/lib/mlton correspond to
>> mlton-20070826 (as might be the case if you installed them from your
>> Linux distribution's package manager or if you installed it from
>> mlton-20070826-1.x86-linux.tgz from mlton.org), then this will almost
>> certainly not work.
>>
>> Generally, the best thing to do when self-compiling is to run the
>> resulting compiler directly from build/bin/mlton.
>>
> The installed MLton is 20100504, so the problem you mentioned hasn't been
> observed. In fact, I tried to build MLton (by MLton) from the source
> root, and after I copied the generated "mlton-compile" to /usr/lib/mlton,
> it works fine. :-)

You are asking for trouble.  There are (implicit) dependencies between
the mlton-compile executable and the libmlton.a runtime library.
While mlton-compile might correctly execute when invoked from the
mlton-2001504 /usr/bin/mlton script, the executables it creates will
likely have problems --- they are compiled with a mlton-compile that
assumes one thing about the runtime, but linked against a runtime that
provides a different thing.

>> Looks like something got corrupted in your mlton script.  Has it been
>> altered from that in SVN HEAD?
> Maybe we've not decribe our difficulty clear. We followd these
> steps to try to build an smlnj heap image (just as you mentioned in a
> previous post):
> 1. run "make" at the source root;
> 2. run "make smlnj-mlton"
> 3. copy the generated "mlton-smlnj.x86-linux" to "build/lib/"

This step is not necessary; the "make smlnj-mlton" will copy
mlton/mlton-smlnj.x86-linux to build/lib/.

> 4. remove "mlton-compile" in the "build/lib/"
> 5. run the script "mlton" in the "build/bin"

> but we got the error message:
> "unknown switch: -fno-common:
> just as in the previous post.
>
> Is there something we forgot?

No.  But your error message says that "-fno-common" is being
interpreted as an argument to mlton-compile, rather than being
interpreted as an argument to the -cc-opt argument to mlton-compile.
This would happen if, for example, you modified bin/mlton-script and
deleted the quotes around the '-O1 -fno-common' on line 101.  The fact
that your were getting additional output means that you changed the
"set -e" to "set -ex" as suggested by Wesley earlier in the thread.
Perhaps you accidentally modified something else.  Try running "svn
diff bin/mlton-script" to see if you have any other edits.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.