Re: [MLton] Status of arm64-darwin mlton ?

Bernard Berthomieu <[email protected]> Thu, 28 Jul 2022 21:31:52 +0200
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============0175893509177570897==
Content-Type: multipart/alternative;
 boundary="------------022Z47r1uGpNzRB2DfogLcb0"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------022Z47r1uGpNzRB2DfogLcb0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Update:

On 27/07/2022 16:56, Bernard Berthomieu wrote:
> I attempted today Christopher's solution (the latter).
> I could build an amd64 mlton generating arm64 code,
> and an arm64 mlton presumably generating arm64 code.
>
> The first seems to works, I'll test it soon on non trivial programs.
> The second fails from the start, even though "Build of MLton succeeded"
> was printed.

Both builds work actually, after a clean retry; thanks for this port.
The failure observed was perhaps a cache effect. The only issue so far is
a minor type translation problem uncovered in FFI.  I'll document the
experiment after this problem is solved.

Best,
   Bernard.


>
> On 22/07/2022 16:48, Matthew Fluet wrote:
>> There is some discussion in the GitHub issues:
>> https://github.com/MLton/mlton/issues/438
>> What seemed to work best is to use the `remote-bootstrap` target from 
>> an amd64-{darwin,linux} machine that SSHes into the arm64-darwin machine.
>>
>> An older discussion 
>> (https://sourceforge.net/p/mlton/mailman/mlton-user/thread/d40764ee-7d1b-41e0-a101-caafe3483879%40www.fastmail.com/#msg37185161) 
>> had some success bootstrapping using Rosetta, but there are two tricks:
>>  * An amd64 executable that (indirectly) invokes `cc` defaults to 
>> generating amd64 code, but for bootstrapping, we want the amd64 MLton 
>> to generate an arm64 MLton.  I think that this was worked around in 
>> the current sources by explicitly passing `-arch arm64` when the 
>> target is `arm64-darwin`.
>> * You need to arrange for the "old" (amd64) MLton to find and 
>> dynamically link to an amd64 version of GMP, while the "new" (arm64) 
>> MLton will need to find and dynamically link to an arm64 version of GMP.
>>
>> -Matthew
>>
>>
>> On Wed, Jul 20, 2022 at 1:43 PM Bernard Berthomieu 
>> <[email protected]> wrote:
>>
>>     Hello,
>>
>>     I might have  soon a limited time access to  an Apple Silicon
>>     MacBook,
>>     that I  would like to use  to produce an arm64-darwin version of some
>>     software I'm maintaining.
>>
>>     I've seen from the CHANGELOG that some progress has been made but
>>     what
>>     is the current status of the port of mlton on target arm64-darwin
>>     ? In
>>     particular,  does  mlton for  arm64-darwin  bootstrap  from mlton for
>>     amd64-darwin on a M1  (thanks to Rosetta2) or do I have to build
>>     a cross
>>     compiler ?
>>
>>     Also, if someone succeeded in  building a native arm64-darwin
>>     mlton or
>>     a cross-compiler  from amd64-darwin, would  you mind sharing it 
>>     for a
>>     try ?
>>
>>     Many thanks for any hints.
>>        Bernard.
>>
>>
>>
>>     _______________________________________________
>>     MLton-devel mailing list
>>     [email protected]; [email protected]
>>     https://lists.sourceforge.net/lists/listinfo/mlton-devel
>>
>>
>>
>> _______________________________________________
>> MLton-devel mailing list
>> [email protected];[email protected]
>> https://lists.sourceforge.net/lists/listinfo/mlton-devel
>
>
>
> _______________________________________________
> MLton-devel mailing list
> [email protected];[email protected]
> https://lists.sourceforge.net/lists/listinfo/mlton-devel

--------------022Z47r1uGpNzRB2DfogLcb0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Update:<br>
    <br>
    <div class="moz-cite-prefix">On 27/07/2022 16:56, Bernard Berthomieu
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:[email protected]">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      I attempted today Christopher's solution (the latter).<br>
      I could build an amd64 mlton generating arm64 code,<br>
      and an arm64 mlton presumably generating arm64 code.<br>
      <br>
      The first seems to works, I'll test it soon on non trivial
      programs.<br>
      The second fails from the start, even though "Build of MLton
      succeeded"<br>
      was printed.<br>
    </blockquote>
    <br>
    Both builds work actually, after a clean retry; thanks for this
    port.<br>
    The failure observed was perhaps a cache effect. The only issue so
    far is<br>
    a minor type translation problem uncovered in FFI.  I'll document
    the<br>
    experiment after this problem is solved.<br>
    <br>
    Best,<br>
      Bernard. <br>
    <br>
    <br>
    <blockquote type="cite"
      cite="mid:[email protected]"> <br>
      <div class="moz-cite-prefix">On 22/07/2022 16:48, Matthew Fluet
        wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:CAMrhFL6VK5oP=bN=CMXQMjipKCBNRh7WeOGhcN6ob+N=aRwuCQ@mail.gmail.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <div dir="ltr">
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large">There
            is some discussion in the GitHub issues:</div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large">  <a
              href="https://github.com/MLton/mlton/issues/438"
              target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">https://github.com/MLton/mlton/issues/438</a></div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large">What
            seemed to work best is to use the `remote-bootstrap` target
            from an amd64-{darwin,linux} machine that SSHes into the
            arm64-darwin machine.</div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large"><br>
          </div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large">An
            older discussion (<a
href="https://sourceforge.net/p/mlton/mailman/mlton-user/thread/d40764ee-7d1b-41e0-a101-caafe3483879%40www.fastmail.com/#msg37185161"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://sourceforge.net/p/mlton/mailman/mlton-user/thread/d40764ee-7d1b-41e0-a101-caafe3483879%40www.fastmail.com/#msg37185161</a>)
            had some success bootstrapping using Rosetta, but there are
            two tricks:</div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large"> * An
            amd64 executable that (indirectly) invokes `cc` defaults to
            generating amd64 code, but for bootstrapping, we want the
            amd64 MLton to generate an arm64 MLton.  I think that this
            was worked around in the current sources by explicitly
            passing `-arch arm64` when the target is `arm64-darwin`.</div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large">* You
            need to arrange for the "old" (amd64) MLton to find and
            dynamically link to an amd64 version of GMP, while the "new"
            (arm64) MLton will need to find and dynamically link to an
            arm64 version of GMP.</div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large"><br>
          </div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large">-Matthew<br>
          </div>
          <div class="gmail_default"
            style="font-family:arial,sans-serif;font-size:large"><br>
          </div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Wed, Jul 20, 2022 at 1:43
            PM Bernard Berthomieu &lt;<a
              href="mailto:[email protected]" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>&gt;
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">Hello,<br>
            <br>
            I might have  soon a limited time access to  an Apple
            Silicon MacBook,<br>
            that I  would like to use  to produce an arm64-darwin 
            version of some<br>
            software I'm maintaining.<br>
            <br>
            I've seen from the CHANGELOG that some progress has been
            made but what<br>
            is the current status of the port of mlton on target
            arm64-darwin ? In<br>
            particular,  does  mlton for  arm64-darwin  bootstrap  from
            mlton for<br>
            amd64-darwin on a M1  (thanks to Rosetta2) or do I have to
            build a cross<br>
            compiler ?<br>
            <br>
            Also, if someone succeeded in  building a native
            arm64-darwin mlton or<br>
            a cross-compiler  from amd64-darwin, would  you mind sharing
            it  for a<br>
            try ?<br>
            <br>
            Many thanks for any hints.<br>
               Bernard.<br>
            <br>
            <br>
            <br>
            _______________________________________________<br>
            MLton-devel mailing list<br>
            <a href="mailto:[email protected]"
              target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">[email protected]</a>;
            <a href="mailto:[email protected]" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a><br>
            <a
              href="https://lists.sourceforge.net/lists/listinfo/mlton-devel"
              rel="noreferrer" target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">https://lists.sourceforge.net/lists/listinfo/mlton-devel</a><br>
          </blockquote>
        </div>
        <br>
        <fieldset class="moz-mime-attachment-header"></fieldset>
        <br>
        <fieldset class="moz-mime-attachment-header"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
MLton-devel mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:[email protected]" moz-do-not-send="true">[email protected]</a>; <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:[email protected]" moz-do-not-send="true">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/mlton-devel" moz-do-not-send="true">https://lists.sourceforge.net/lists/listinfo/mlton-devel</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
MLton-devel mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:[email protected]">[email protected]</a>; <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/mlton-devel">https://lists.sourceforge.net/lists/listinfo/mlton-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>

--------------022Z47r1uGpNzRB2DfogLcb0--


--===============0175893509177570897==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============0175893509177570897==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
MLton-devel mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-devel

--===============0175893509177570897==--