develooper Front page | perl.perl6.compiler | Postings from June 2012

Can't build NQP on a Raspberry Pi (without bodging)

Thread Next
Nicholas Clark
June 28, 2012 13:49
Can't build NQP on a Raspberry Pi (without bodging)
Message ID:
The Raspberry Pi has a 700MHz ARM11-based CPU, 256Mb of RAM (of which at least
32Mb is used by the GPU), and uses an SD card for the filesystem. This is how
it's $35 (+ tax and shipping)

It will build Perl 5 in 2 hours, and takes a further 4 hours to run the tests.
(all pass)

So, I attempted to build Rakudo on my Raspberry Pi, expecting it to go wrong.
It didn't quite pan out the way I expected.

Parrot built just fine. Immediately things went wrong with NQP:

Parrot installed.
Building NQP ...
/usr/bin/perl --with-parrot=/home/nick/Perl/rakudo/install/bin/parrot --make-install
Verifying installation ...
Using /home/nick/Perl/rakudo/install/bin/parrot (version RELEASE_4_5_0).
* configure package dyncall
guess operating system linux
guess arch
error: unsupported architecture armv6l
Command failed (status 256): cd 3rdparty/dyncall && sh configure
Command failed (status 256): /usr/bin/perl --with-parrot=/home/nick/Perl/rakudo/install/bin/parrot --make-install

real    75m55.607s
user    63m12.770s
sys     3m1.640s

It seems that dyncall doesn't recognise arm6el as a class of ARM architecture
which it supports. Given that it supports iOS, and has a configure option for
ARM, it seems pretty clear that it does, so I bodged it this this:

nick@raspberrypi ~/Perl/rakudo/nqp $ git diff
diff --git a/ b/
index 5539471..f1a1c00 100644
--- a/
+++ b/
@@ -125,7 +125,7 @@ MAIN: {
             system_or_die('cd 3rdparty\dyncall && Configure.bat' . $configure_a
             $config{'dyncall_build'} = "cd 3rdparty/dyncall && $make BUILD_DIR=
         } else {
-            system_or_die('cd 3rdparty/dyncall && sh configure');
+            system_or_die('cd 3rdparty/dyncall && sh configure --target-arm-arm
             if ($^O eq 'netbsd') {
                 $config{'dyncall_build'} = "cd 3rdparty/dyncall && BUILD_DIR=. 
             } else {

With that, NQP has been builds and installs, given time:

real    90m49.874s
user    87m53.620s
sys     0m40.190s

However, the Rakudo build then fails with a SEGV on

/home/nick/Perl/rakudo/install/bin/nqp --vmlibs=perl6_group,perl6_ops  --target=pir --output=src/gen/perl6-actions.pir --encoding=utf8 src/Perl6/

So I tried it again under gdb it completes. Bah. No backtrace.

I then re-ran make and the very next command also SEGV'd:

nick@raspberrypi ~/Perl/rakudo $ time make
/home/nick/Perl/rakudo/install/bin/nqp --vmlibs=perl6_group,perl6_ops  --target=pir --output=src/gen/perl6-actions.pir --encoding=utf8 \
Segmentation fault
make: *** [blib/Perl6/Actions.pbc] Error 139

real    8m16.604s
user    8m13.570s
sys     0m1.050s

So I upped ulimit to get a core file, re-ran, and, bother, no error.

However, it does end up failing here:

The following step can take a long time, please be patient.
./perl6 --setting=NULL --optimize=3 --target=pir --stagestats --output=src/gen/CORE.setting.pir src/gen/CORE.setting
make: *** [CORE.setting.pbc] Error 137

real    107m48.770s
user    85m40.700s
sys     1m21.840s

(it ran out of RAM and swap. When I idle I see)

$ free
             total       used       free     shared    buffers     cached
Mem:        220616      24892     195724          0       5572       7080
-/+ buffers/cache:      12240     208376
Swap:       102396      11244      91152

So clearly 224Mb of RAM and 100Mb of swap aren't enough.

At this point I tested things that did build. Parrot passes all tests:

Test Summary Report
t/dynpmc/select.t                         (Wstat: 0 Tests: 14 Failed: 0)
  TODO passed:   14
Files=395, Tests=13921, 3309 wallclock secs (63.36 usr  5.22 sys + 2580.54 cusr 203.41 csys = 2852.53 CPU)
Result: PASS

NQP fails 1 test:

Test Summary Report
t/nqp/60-bigint.t             (Wstat: 0 Tests: 34 Failed: 3)
  Failed tests:  28-29, 34
Files=64, Tests=584, 773 wallclock secs ( 5.03 usr  0.61 sys + 751.26 cusr 11.36 csys = 768.26 CPU)
Result: FAIL
make: *** [core-test] Error 1

$ ./nqp t/nqp/60-bigint.t 
ok 1 - can round-trip negative number (string)
ok 2 - can round-trip negative number (string) by boxing
ok 3 - can round-trip negative number by unboxing
ok 4 - nqp::iseq_I can return false
ok 5 - nqp::iseq_I can return true
ok 6 - multiplication
ok 7 - addition
ok 8 - subtraction
ok 9 - division
ok 10 - bitshift left
ok 11 - original not modified by bitshift left
ok 12 - bitshift right
ok 13 - bit and
ok 14 - bit or
ok 15 - bit xor
ok 16 - bit negation
ok 17 - Bit ops (RT 109740)
ok 18 - can box to a complex type with a P6bigint target
ok 19 - can get a bigint from a string with boxing type
ok 20 - addition works on boxing type
ok 21 - pow (int, positive)
ok 22 - pow 0 ** large_number
ok 23 - pow 1 ** large_number
ok 24 - 2**100 to float
ok 25 - (-2)**101 to float
ok 26 - 123456789 * (-2)**101 to float
ok 27 - bigint -> float, 1e16
not ok 28 - to_num and from_num round-trip
not ok 29 - to_num and from_num round-trip (negative number)
ok 30 - base_I with base 10
ok 31 - base_I with base 16
ok 32 - nqp::expmod_I
ok 33 - div_In santiy
not ok 34 - div_In with big numbers

So, I commandeered a mobile phone charger to power an external USB hard drive,
and now with 512Mb of swap tried this:

$ /usr/bin/time -v ./perl6 --setting=NULL --optimize=3 --target=pir --stagestats --output=src/gen/CORE.setting.pir src/gen/CORE.setting; sleep 30; killall vmstat
Stage parse: 52535.669
Stage syntaxcheck: 0.387
Stage past: 0.221
Stage optimize: 9936.757

The machine crashed after about 22 hours at 100% CPU. Not sure if this is
because the outside temperature today is 28°C, and it felt unhappy.

This is rather annoying as I think we were about 50% through my estimate of
how long "Stage post" was going to take, with hopefully only 6 hours go go,
ie 28 hours of swap hell just for that command.

It would be wonderful if Rakudo's memory usage would drop. I think that that's
going to be easier than finding a faster swap device.

Nicholas Clark

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About