Rakudo is made available through a series of distributions that contain the compiler, documentation, and some modules–things that we think might be useful to someone wanting to write Perl 6 programs. These distributions are called Rakudo * or Rakudo Star.
The latest source tarballs and Microsoft Installer (MSI) files for Rakudo Star distributions are currently available at http://rakudo.org/downloads/star/.
Which download to choose?
If you’re on Windows, you have to choose which virtual machine you want to run your Rakudo on. Parrot is rather stable, but the asynchronous I/O and concurrency features are not implemented on it. MoarVM (aka “moar”) is younger, faster, uses less memory and has asynchronous I/O and concurrency, but the concurrency implementation is not 100% stable as of 2014.08.
Building the compiler from source
Tarballs of each monthly compiler release are available from http://rakudo.org/downloads/rakudo.
These tarballs do not contain the documentation or modules found in Rakudo Star. It is strongly recommended that you download a Rakudo Star distribution unless you are a developer looking to hack on the compiler internals.
Since Rakudo is under rapid development, potential developers should download Rakudo directly from github and build from there:
$ git clone git://github.com/rakudo/rakudo.git
If you don’t have git installed, you can also get a tarball or zip of the latest development snapshot of Rakudo from github by visiting http://github.com/rakudo/rakudo/tree/nom and clicking “Download”. Then unpack the tarball or zip.
Building Rakudo from the sources requires Perl 5.8 or newer, a C compiler, a make utility, git, and in case you build for the parrot backend the ICU4C library.
Once these prerequisites are installed, build and install Rakudo as follows:
$ cd rakudo
$ perl Configure.pl --gen-parrot
--gen-moar --gen-nqp --backends=parrot,jvm,moar
$ make install
If you want to build Rakudo for a single backend, just run Configure.pl in this example:
$ perl Configure.pl
--gen-moar --gen-nqp --backends=moar
This will build and install a “perl6″ or “perl6.exe” executable, by default in the install/bin/ subdirectory of the rakudo build directory.
The “–backends” option tells which backends to use. To build both for parrot and jvm backend pass both as shown above. The first mentioned backend will be installed as “perl6″ (or “perl6.exe”) in addition to “perl6-p” and “perl6-j”/”perl6-m”. The option “–gen-parrot” is not needed when building for jvm only. Identically the option –gen-moar is only needed when building for the “moar” backend.
The “–gen-parrot” option tells Configure.pl to automatically download (via ‘git’) and build the version of Parrot most appropriate for the copy of Rakudo you currently have. It’s okay to use the –gen-parrot option on later invocations of Configure.pl; the configure system will re-build Parrot only if a newer version is needed for whatever version of Rakudo you’re working with.
Likewise “–gen-nqp” downloads and builds a copy of NQP, a smaller Perl 6 compiler used for building Rakudo.
And finally “–gen-moar” will download and build MoarVM, a virtual machine built especially for Rakudo Perl 6 and the NQP Compiler Toolchain.
To run a Perl 6 program with Rakudo, include the install directory in your system PATH variable and issue a command like:
$ perl6 hello.pl
If the Rakudo compiler is invoked without an explicit script to run, it enters a small interactive mode that allows Perl 6 statements to be executed from the command line. Each line entered is treated as a separate compilation unit, however (which means that subroutines are preserved after they are defined, but variables are not).
Running the test suite
Entering “make test” will run a small test suite that comes bundled with Rakudo. This is a simple suite of tests, designed to make sure that the Rakudo compiler is basically working and that it’s capable of running a simple test harness.
Running “make spectest” will import relevant portions of the official Perl 6 test suite from Github (http://github.com/perl6/roast) and run all of the tests that are currently known to pass.
Note On GCC Version 4.1.2/4.1.3
These versions of GCC contain a bug that prevents building of Rakudo in the way described above. A workaround that has been known to work is to configure with optimization, like this:
perl ./Configure.pl --gen-parrot --gen-parrot-option=--optimize
We’ve looked for a workaround we could do in the code to try and avoid triggering the GCC bug, but there didn’t seem to be an obvious one. Please either try the workaround above, or use a different version of GCC.
For a number of platforms there are packaged versions of Rakudo (the compiler only), which are very easy to install, but might be out of date.