mlton icon indicating copy to clipboard operation
mlton copied to clipboard

MLton with musl libc

Open unspecd opened this issue 3 years ago • 5 comments

Hello! It would be great to have official release binaries built against musl.

unspecd avatar Mar 09 '21 23:03 unspecd

I seem to recall trying to build MLton against musl on Fedora with a cross compilation toolchain and had some build errors that I didn't fully investigate. I vaguely remember it being something to do with requesting POSIX features.

MatthewFluet avatar Mar 10 '21 15:03 MatthewFluet

I managed to build MLton with musl on Void Linux following the instructions in Makefile.

$ make REMOTE_MACHINE=void-linux-host remote-bootstrap

Some details:

$ uname -a
Linux front 5.10.22_1 #1 SMP 1615288648 x86_64 GNU/Linux
$ cat hello.sml
print "hello, world!\n";
$ mlton hello.sml
$ ./hello
hello, world!
$ ldd hello
	/lib/ld-musl-x86_64.so.1 (0x7f9d86088000)
	libgmp.so.10 => /lib/libgmp.so.10 (0x7f9d85fe5000)
	libc.so => /lib/ld-musl-x86_64.so.1 (0x7f9d86088000)

unspecd avatar Mar 10 '21 16:03 unspecd

Nice to see that it worked. If you want to contribute that build, then I'd be willing to add it to the releases.

MatthewFluet avatar Mar 11 '21 21:03 MatthewFluet

Sorry for the delay... I don't think it's a good idea to add third party build to the releases :)

unspecd avatar Dec 30 '21 05:12 unspecd

Fair enough.

I did some experimenting, and it might not be too difficult to build on the ubuntu GitHub Actions images using musl-gcc. That would allow it to be a first-party build.

MatthewFluet avatar Dec 30 '21 17:12 MatthewFluet

See MLton/mlton#522 and https://github.com/ii8/mlton-builds/releases for a variety of linux-musl builds.

MatthewFluet avatar Nov 28 '23 10:11 MatthewFluet