14

I am playing with perl6 version which built on MoarVM on windows. I created some perl6 file and want to compile it to exe. I tried the following:

perl6 --target=MAST r.pl>r

Now I want to compile the r to executable

I found this link which talk about how to that using Parrot but I am using MoarVM target: http://perlgeek.de/blog-en/perl-6/my-first-executable.writeback

my question how can i compile MoarvVM targeted file to windows executable ?

Pat
  • 36,282
  • 18
  • 72
  • 87
smith
  • 3,232
  • 26
  • 55
  • MoarVM claims it works with Rakudo. See https://github.com/MoarVM/MoarVM#building-a-rakudo-with-moarvm – Robert Harvey Nov 27 '14 at 21:07
  • I am using MoarVM on Rakudo – smith Nov 27 '14 at 21:09
  • 2
    brrt (who is working on this exact thing) hasn't responded yet but lead Rakudo dev jnthn said: 'Short answer is "there's not a way to do that yet" and --target=mast is just a debugging aid, so it's really not a suitable thing to use.' – raiph Nov 30 '14 at 16:03
  • 1
    You can however do --target=jar with the Rakudo JVM implementation and then get out a jar file suitable for `java -jar program.jar` – Matt Oates Apr 13 '16 at 19:47
  • In the past GSOC a project was done to investigate the possibility of generating a single stand-alone executable for an application including all of its dependencies. Although this hasn't lead to a usable product yet, progress has been made. As with many open source projects, it lacks tuits. So if you want to contribute to that project, please make yourself known on the #raku channel on IRC freenode.org. – Elizabeth Mattijsen Nov 30 '19 at 15:20

2 Answers2

3

Unfortunately, the answer is to target JVM and one of the many nice tools for turning a JAR into an executable. MoarVM doesn't have that tooling at this point (and given the lack of current overlap between perl6 hackers and Windows users, probably won't for some time).

Daniel Lathrop
  • 191
  • 1
  • 8
3

One of the things that attracted me to the language, was that it was supposed to be compilable, I thought "sure, it would build exe files for me", unfortunately, it does not (last I checked).

compile:

perl6 --target=mbc --output=test.moarvm  -e 'say 42'

run:

perl6 -e 'CompUnit::Loader.load-precompilation-file("test.moarvm".IO)'

However, you can compile the program t the intermediate moarvm machine, do KEEP IN MIND this is not porable, so you have to recompile on each target.

I think this code was legated to me by somebody that really knew perl6 on the irc channel, I don't understand how it works, though.

I advise if you need a compiled language, to wait for real support from the compiler guys or simply to use something like rust or golang (that is what I ended up using, I'm happy).

I know rust doesn't have all the "bells and whistles" that Perl6 has, but it gets the job done...

Felipe Valdes
  • 1,998
  • 15
  • 26