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

Matthew Fluet <[email protected]> Fri, 22 Jul 2022 10:48:27 -0400
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <CAMrhFL6VK5oP=bN=CMXQMjipKCBNRh7WeOGhcN6ob+N=aRwuCQ@mail.gmail.com>
--===============7957724701568806198==
Content-Type: multipart/alternative; boundary="000000000000f13ec205e465ed44"

--000000000000f13ec205e465ed44
Content-Type: text/plain; charset="UTF-8"

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
>

--000000000000f13ec205e465ed44
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,sa=
ns-serif;font-size:large">There is some discussion in the GitHub issues:</d=
iv><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-=
size:large">=C2=A0 <a href=3D"https://github.com/MLton/mlton/issues/438" ta=
rget=3D"_blank">https://github.com/MLton/mlton/issues/438</a></div><div cla=
ss=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size:large"=
>What seemed to work best is to use the `remote-bootstrap` target from an a=
md64-{darwin,linux} machine that SSHes into the arm64-darwin machine.</div>=
<div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-siz=
e:large"><br></div><div class=3D"gmail_default" style=3D"font-family:arial,=
sans-serif;font-size:large">An older discussion (<a href=3D"https://sourcef=
orge.net/p/mlton/mailman/mlton-user/thread/d40764ee-7d1b-41e0-a101-caafe348=
3879%40www.fastmail.com/#msg37185161">https://sourceforge.net/p/mlton/mailm=
an/mlton-user/thread/d40764ee-7d1b-41e0-a101-caafe3483879%40www.fastmail.co=
m/#msg37185161</a>) had some success bootstrapping using Rosetta, but there=
 are two tricks:</div><div class=3D"gmail_default" style=3D"font-family:ari=
al,sans-serif;font-size:large">=C2=A0* 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.=C2=A0 I think that this w=
as worked around in the current sources by explicitly passing `-arch arm64`=
 when the target is `arm64-darwin`.</div><div class=3D"gmail_default" style=
=3D"font-family:arial,sans-serif;font-size:large">* You need to arrange for=
 the &quot;old&quot; (amd64) MLton to find and dynamically link to an amd64=
 version of GMP, while the &quot;new&quot; (arm64) MLton will need to find =
and dynamically link to an arm64 version of GMP.</div><div class=3D"gmail_d=
efault" style=3D"font-family:arial,sans-serif;font-size:large"><br></div><d=
iv class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size:=
large">-Matthew<br></div><div class=3D"gmail_default" style=3D"font-family:=
arial,sans-serif;font-size:large"><br></div></div><br><div class=3D"gmail_q=
uote"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Jul 20, 2022 at 1:43 PM=
 Bernard Berthomieu &lt;<a href=3D"mailto:[email protected]" targe=
t=3D"_blank">[email protected]</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I might have=C2=A0 soon a limited time access to=C2=A0 an Apple Silicon Mac=
Book,<br>
that I=C2=A0 would like to use=C2=A0 to produce an arm64-darwin=C2=A0 versi=
on of some<br>
software I&#39;m maintaining.<br>
<br>
I&#39;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,=C2=A0 does=C2=A0 mlton for=C2=A0 arm64-darwin=C2=A0 bootstrap=
=C2=A0 from mlton for<br>
amd64-darwin on a M1=C2=A0 (thanks to Rosetta2) or do I have to build a cro=
ss<br>
compiler ?<br>
<br>
Also, if someone succeeded in=C2=A0 building a native arm64-darwin mlton or=
<br>
a cross-compiler=C2=A0 from amd64-darwin, would=C2=A0 you mind sharing it=
=C2=A0 for a<br>
try ?<br>
<br>
Many thanks for any hints.<br>
=C2=A0=C2=A0 Bernard.<br>
<br>
<br>
<br>
_______________________________________________<br>
MLton-devel mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">MLto=
[email protected]</a>; <a href=3D"mailto:[email protected]"=
 target=3D"_blank">[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/mlton-devel" rel=3D=
"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo=
/mlton-devel</a><br>
</blockquote></div>

--000000000000f13ec205e465ed44--


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


--===============7957724701568806198==
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

--===============7957724701568806198==--