[m-dev.] Mercury, Emscripten, and WebAssembly
Patrick Henning
path at fea.st
Sun Mar 15 12:12:54 AEDT 2020
Hello again, I’ve made some progress with this but am still struggling. I was able to successfully carry out the “make" step with grade hlc.gc without errors occurring, but have not been able to run ‘make install’ successfully. For now I am attempting to make do with the results of the “make” step.
Currently I am stuck on a linking error: when attempting to do the final step of linking a simple mercury program object file with `emcc -o hello.js hello_init.o hello.o /mercury-srcdist-20.01.1/library/libmer_std.a /mercury-srcdist-20.01.1/runtime/libmer_rt.a /mercury-srcdist-20.01.1/boehm_gc/libgc.a`, I get two errors about symbols “MR_box_int64” and “MR_box_uint64” being undefined.
These two symbols are defined in mercury.h, so I would expect them to be present in libmer_rt.a, but examining it with llvm-nm seems to indicate that they are not defined there or in fact in any of the other library files. Can anyone help point me in the direction of what I am missing? Does libmer_rt need to be built in a specific way to ensure that “MR_box_int64” and “MR_box_uint64” are included?
Thank you,
Patrick
On Jan 29, 2020, 3:27 PM -0800, Patrick Henning <path at fea.st>, wrote:
> Great, I’ll try both, thank you!
> On Jan 28, 2020, 3:29 PM -0800, Peter Wang <novalazy at gmail.com>, wrote:
> > On Wed, 29 Jan 2020 10:13:47 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
> > >
> > > Hi Patrick,
> > >
> > > On Tue, 28 Jan 2020, Patrick Henning wrote:
> > >
> > > > I am writing to request help with compiling Mercury code to
> > > > WebAssembly via Emscripten. I believe this would involve using the
> > > > Mercury compiler to compile the gc, runtime, standard library, etc, to
> > > > c; and then using Emscripten to compile the c to WebAssembly code.
> > > > From there it should be possibly to compile arbitrary Mercury code to
> > > > c and then use Emscripten to compile that, linking in the previously
> > > > prepared runtime and standard library and whatnot.
> > > >
> > > > Does anyone know if and how it would be possbile to carry out the
> > > > first step of compiling all the Mercury preliminaries to c (similar to
> > > > the functionality that the '-C' flag for mmc provides)?
> > >
> > > It's certainly possible to compile it all to C; that's how we build the
> > > source distribution.
> >
> > You can also do it with: mmc --make prog.cs
> >
> > Peter
> _______________________________________________
> developers mailing list
> developers at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/developers/attachments/20200314/71a7524a/attachment.html>
More information about the developers
mailing list