Building Rakudo Star Perl6 distribution on Windows 10 with Microsoft Visual Studio tools

It’s been more than a year since I last looked at Perl6.

Time flies. Pretty soon, it is going to be Christmas for the first time again. Well, OK, that didn’t make much sense: What matters is the fact that there have been huge developments on the Perl6 front this year, and I would like to try to catch up.

So, I went to the Rakudo Star downloads page, and grabbed the rakudo-star-2015.11 tarball. Yes, there are MSI installers for the previous release, but I decided that being on Windows is no reason to depend on MSI installers. Besides, I don’t like putting more and more directories under C:\.

For the first attempt, I decided to use Microsoft Visual Studio 2013 build tools, and I also decided not to tinker with compiler optimization options.

curl -O http://rakudo.org/downloads/star/rakudo-star-2015.11.tar.gz
tar -xvf rakudo-star-2015.11.tar.gz
perl Configure.pl --prefix=c:/opt/perl6 --backends=moar --gen-moar
nmake
nmake rakudo-test

This gave me a single test failure:

Test Summary Report
-------------------
t\01-sanity\55-use-trace.t         (Wstat: 256 Tests: 3 Failed: 1)
  Failed test:  3
  Non-zero exit status: 1
Files=44, Tests=565, 86 wallclock secs ( 0.42 usr +  0.50 sys =  0.92 CPU)
Result: FAIL

The failure is somewhat trivial. See if you can spot it:

# Failed test 'is the trace ok?'
# at t\01-sanity\55-use-trace.t line 27
# expected: "4 (C:\\..\\src\\rakudo-star-2015.11\\rakudo/t\\01-sanity\\55-use-trace.t.trace:4)\n\$a++\n10 (C:\\...\\src\\rakudo-star-2015.11\\rakudo/t\\01-sanity\\55-use-trace.t.trace:10)\n\$a -= 1"
# got: "4 (C:\\...\\src\\rakudo-star-2015.11\\rakudo/t\\01-sanity\\55-use-trace.t.trace:4)\n\$a++\n10 (C:\\...\\src\\rakudo-star-2015.11\\rakudo/t\\01-sanity\\55-use-trace.t.trace:10)\n\$a -= 1\n"
# Looks like you failed 1 test of 3
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests

Yes, there is an extra newline at the end. I don’t know if there is any great significance to this.

Then I did a:

nmake rakudo-spectest

I got a warning:

Inline::Perl5 not installed: not running Perl 5 integration tests

The spec tests take a lot longer. I had the following failures:

I looked at a few these failures. They do seem to be real failures. For example:

C:\..\rakudo-star-2015.11\rakudo> perl t/harness --verbosity=1 --moar t\spec\S19-command-line\dash-e.t
t\spec\S19-command-line\dash-e.t ..
1..4
ok 1 - -e print $something works
not ok 2 - -e print $something works with non-ASCII string literals

# Failed test '-e print $something works with non-ASCII string literals'
# at C:\...\rakudo-star-2015.11\rakudo\t\spec\packages\Test\Util.pm line 58
#      got out: "?"
# expected out: "ȧ"
ok 3 - -e works with non-ASCII program texts
ok 4 - -e works correctly as a stopper
# Looks like you failed 1 test of 4
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/4 subtests

Test Summary Report
-------------------
t\spec\S19-command-line\dash-e.t (Wstat: 256 Tests: 4 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
Files=1, Tests=4,  5 wallclock secs ( 0.06 usr +  0.00 sys =  0.06 CPU)
Result: FAIL

Also, t\spec\S32-io\IO-Socket-Async.rakudo.moar just froze, needing to be killed from Windows Task Manager.

t\spec\S32-io\IO-Socket-Async.rakudo.moar
  ..................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 6/6 subtests

Another test failure that caught my attention was in t\spec\S32-io\io-spec-win.t:299. It seems like all tests on a specific IO::Spec::Win32 run successfully, but tests using the IO::Spec class methods fail:

ok 206 - updir is ".."
Method 'devnull' not found for invocant of class 'IO::Spec'
  in block  at t\spec\S32-io\io-spec-win.t:299

# Looks like you planned 209 tests, but ran 206
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/209 subtests

Test Summary Report
-------------------
t\spec\S32-io\io-spec-win.t (Wstat: 65280 Tests: 206 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 209 tests but ran 206.
Files=1, Tests=206,  6 wallclock secs ( 0.11 usr +  0.03 sys =  0.14 CPU)
Result: FAIL

Here is the relevant test code:

if $*DISTRO.name !~~ any() {
    skip-rest 'Win32ish on-platform tests'
}
else {
    # double check a couple of things to see if IO::Spec loaded correctly
    is IO::Spec.devnull, 'nul', 'devnull is nul';
    is IO::Spec.rootdir, '\\',  'rootdir is "\\"';
    ok {.IO.d && .IO.w}.(IO::Spec.tmpdir), "tmpdir: {IO::Spec.tmpdir} is a writable directory";
}

Here is the bug report. As you can tell, I have no idea what is going on.

Update: I think I figured it out. Here is the pull request. It turns out invoking methods on IO::Spec is wrong. One must use $*SPEC which basically serves the role of Perl’s File::Spec.

It’s bit of a bummer because the whole point is to be able to use IO::Spec without knowing the platform.

For reference, here is the complete list of test failures. I am going to investigate these as well, but it would be great if someone could check to see if they can replicate the problems I am seeing.

Test Summary Report
-------------------
t\spec\S02-literals\heredocs.t                              (Wstat: 4608 Tests: 22 Failed: 18)
  Failed tests:  2-3, 5, 7-18, 20-22
  Non-zero exit status: 18
t\spec\S02-literals\quoting.t                               (Wstat: 1280 Tests: 181 Failed: 5)
  Failed tests:  115-116, 126, 129, 177
  Non-zero exit status: 5
t\spec\S16-filehandles\io_in_while_loops.t                  (Wstat: 512 Tests: 17 Failed: 2)
  Failed tests:  14, 16
  Non-zero exit status: 2
t\spec\S17-supply\lines.t                                   (Wstat: 1024 Tests: 21 Failed: 4)
  Failed tests:  10-11, 20-21
  Non-zero exit status: 4
t\spec\S19-command-line-options\02-dash-n.t                 (Wstat: 512 Tests: 3 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 2
t\spec\S19-command-line\dash-e.t                            (Wstat: 256 Tests: 4 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
t\spec\S19-command-line\repl.t                              (Wstat: 0 Tests: 0 Failed: 0)
  Parse errors: Bad plan.  You planned 1 tests but ran 0.
t\spec\S22-package-format\local.t                           (Wstat: 768 Tests: 24 Failed: 3)
  Failed tests:  15-16, 24
  Non-zero exit status: 3
t\spec\S26-documentation\04-code.t                          (Wstat: 512 Tests: 50 Failed: 2)
  Failed tests:  7, 23
  Non-zero exit status: 2
t\spec\S26-documentation\05-comment.t                       (Wstat: 768 Tests: 9 Failed: 3)
  Failed tests:  3, 6, 9
  Non-zero exit status: 3
t\spec\S32-io\IO-Socket-Async.rakudo.moar                   (Wstat: 256 Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 6 tests but ran 0.
t\spec\S32-io\io-spec-win.t                                 (Wstat: 65280 Tests: 206 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 209 tests but ran 206.
t\spec\S32-io\move.t                                        (Wstat: 1024 Tests: 29 Failed: 4)
  Failed tests:  14, 26, 28-29
  Non-zero exit status: 4
t\spec\S32-io\pipe.t                                        (Wstat: 65280 Tests: 10 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 10.
t\spec\S32-io\rename.t                                      (Wstat: 1024 Tests: 29 Failed: 4)
  Failed tests:  14, 26, 28-29
  Non-zero exit status: 4
t\spec\integration\advent2009-day21.t                       (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
t\spec\integration\advent2012-day06.t                       (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
t\spec\integration\advent2012-day10.t                       (Wstat: 256 Tests: 26 Failed: 1)
  Failed test:  6
  Non-zero exit status: 1
t\spec\integration\advent2012-day23.t                       (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
t\spec\integration\advent2012-day24.t                       (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
t\spec\integration\advent2013-day04.t                       (Wstat: 512 Tests: 7 Failed: 2)
  Failed tests:  1, 3
  Non-zero exit status: 2
t\spec\integration\advent2014-day16.t                       (Wstat: 2560 Tests: 21 Failed: 10)
  Failed tests:  4-13
  Non-zero exit status: 10
t\spec\rosettacode\greatest_element_of_a_list.t             (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
t\spec\rosettacode\sierpinski_triangle.t                    (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1079, Tests=50184, 3582 wallclock secs (15.81 usr +  8.28 sys = 24.09 CPU)
Result: FAIL

PS: You can comment on this post on /r/perl6.