问题
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 ?
回答1:
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).
回答2:
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...
来源:https://stackoverflow.com/questions/27178599/how-can-i-compile-perl6-file-to-exe