How can I compile perl6 file to exe
Asked Answered
W

2

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 ?

Weakminded answered 27/11, 2014 at 21:1 Comment(7)
MoarVM claims it works with Rakudo. See github.com/MoarVM/MoarVM#building-a-rakudo-with-moarvmDesolation
I am using MoarVM on RakudoWeakminded
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.'Blearyeyed
You can however do --target=jar with the Rakudo JVM implementation and then get out a jar file suitable for java -jar program.jarDeedee
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.Gendarmerie
2024 update I'm briefly reviewing SOs related to producing a stand-alone exe. I've decided to write some FYI comments. I've found this SO plus 3 from 8 years ago: how do I create a stand-alone executable with perl 6?, how to compile perl6 program to generate bytecode?, Deploying self contained Perl 6 script.Blearyeyed
See also (reddit comment "Distributing Raku Programs".Blearyeyed
P
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).

Pancreatotomy answered 13/10, 2016 at 22:20 Comment(1)
may I know where you get this "lack of overlap" idea exactly? is there any data to support this claim?Prate
P
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...

Prate answered 21/11, 2017 at 16:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.