Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building multiple backends for Raku fails

Tags:

perl

raku

rakudo

After reading README.md at https://github.com/rakudo/rakudo specifically here, I ventured on building multiple backends for rakudo.

I used 64-bit Ubuntu 20.04 to do that. First I installed

  • build essential, libencode-perl
  • default-jdk to prepare the machine for compiling rakudo.

After cloning the repo, when I run the command perl Configure.pl --backends=moar,jvm --prefix=/usr, I get the following error:

root@1145eac1ed77:/rakudo# perl Configure.pl --backends=moar,jvm --prefix=/usr
No pre-existing installed file found at /usr/bin/nqp-m
No pre-existing installed file found at /usr/bin/nqp-j
No pre-existing installed file found at /usr/bin/nqp-m
No pre-existing installed file found at /usr/bin/nqp-j
Use of uninitialized value $str in substitution (s///) at /rakudo/3rdparty/nqp-configure/lib/NQP/Config.pm line 1420.
Use of uninitialized value $str in substitution (s///) at /rakudo/3rdparty/nqp-configure/lib/NQP/Config.pm line 1421.
Use of uninitialized value in concatenation (.) or string at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 361.
Use of uninitialized value in quotemeta at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 371.
Use of uninitialized value in substitution (s///) at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 371.
Use of uninitialized value in substitution (s///) at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 371.
Use of uninitialized value in quotemeta at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 373.
Use of uninitialized value in sprintf at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 414.
Redundant argument in sprintf at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 414.
Use of uninitialized value in concatenation (.) or string at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 423.
Use of uninitialized value in concatenation (.) or string at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 423.
Using /usr/bin/nqp-m (version  / MoarVM ).
Use of uninitialized value in sprintf at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 428.
Redundant argument in sprintf at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 428.
===SORRY!===
  jvm::runtime.jars value not available from /usr/bin/nqp-j --show-config.

  To automatically clone (git) and build a copy of NQP 2020.02.1-154-ga7b0b7be2,
  try re-running Configure.pl with the '--gen-moar' option.
  Or, use '--prefix=' to explicitly specify the path where the NQP and MoarVM
  executables can be found that are use to build Rakudo. at /rakudo/3rdparty/nqp-configure/lib/NQP/Config.pm line 192.
 at /rakudo/3rdparty/nqp-configure/lib/NQP/Config.pm line 34.
        NQP::Config::__ANON__("===SORRY!===\x{a}  jvm::runtime.jars value not available from /us"...) called at /rakudo/3rdparty/nqp-configure/lib/NQP/Config.pm line 192
        NQP::Config::sorry(NQP::Config::Rakudo=HASH(0x55e4cb9c5258), "jvm::runtime.jars value not available from /usr/bin/nqp-j --s"..., "\x{a}To automatically clone (git) and build a copy of NQP 2020.02"..., "try re-running Configure.pl with the '--gen-moar' option.", "Or, use '--prefix=' to explicitly specify the path where the "..., "executables can be found that are use to build Rakudo.") called at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 576
        NQP::Config::Rakudo::post_active_backends(NQP::Config::Rakudo=HASH(0x55e4cb9c5258)) called at /rakudo/3rdparty/nqp-configure/lib/NQP/Config.pm line 660
        NQP::Config::configure_active_backends(NQP::Config::Rakudo=HASH(0x55e4cb9c5258)) called at /rakudo/tools/lib/NQP/Config/Rakudo.pm line 473
        NQP::Config::Rakudo::configure_active_backends(NQP::Config::Rakudo=HASH(0x55e4cb9c5258)) called at Configure.pl line 102

How can it be fixed?

I was wondering what ALL in the command perl Configure.pl --backends=ALL refers to.

There was a project (still there merged in master I guess) Rakudo.js here and here. Is this the Javascript backend? Does that ALL means moar, jvm and Javascript backends?

like image 769
Suman Khanal Avatar asked Apr 25 '20 18:04

Suman Khanal


1 Answers

As pointed out by @ugexe, I was missing --gen-moar in my command.

For future reference, I want to document what I learned after repeated attempts of trying to build Rakudo.

Moar and JVM backends


For building moar and jvm backends you need the dependencies

apt-get install -y gcc \
        libc6-dev \
        libencode-perl \
        wget \
        libzstd-dev \
        default-jdk \
        make

and run the command

perl Configure.pl --prefix=/usr --gen-moar --backends=moar,jvm --relocatable

for building. After the successful build, you will get rakudo-m, rakudo-gdb-m, rakudo-valgrind-m, rakudo-lldb-m for moar backend and rakudo-j, rakudo-debug-j for jvm backends.

Javascript and Moar backends


You cannot build isolated javascript backend. When building the js backend you must also build moar. So to build javascript backend, the command to build will be,

perl Configure.pl --prefix=/usr --gen-moar --backends=moar,js --relocatable

The extra dependencies to build javascript backend is availability of nodejs, g++ and npm which can be obtained by

apt-get install gcc g++ \
        libc6-dev \
        libencode-perl \
        wget \
        libzstd-dev \
        nodejs \
        npm \
        make

But while building javascript backend, I got the following error,

'/usr/bin/perl' tools/build/npm-install-or-link.pl . src/vm/js/nqp-runtime nqp-runtime 
Can't exec "npm": No such file or directory at tools/build/npm-install-or-link.pl line 18.
=== SORRY! === `npm install /rakudo/nqp/src/vm/js/nqp-runtime` failed with exit code -1 (72057594037927935)
make: *** [Makefile:852: js-deps] Error 255

Search reveals that

If you are developing nqp-js, you may want to pass the --link option to configure to have the nqp-runtime linked instead of installed

Though there is no problem building isolated NQP. I am unsure how to npm link while automating the build of rakudo.

ALL backends


I learnt that ALL indeed means moar, jvm and js backends. This is confirmed when you run the command

perl Configure.pl --prefix=/usr --gen-moar --backends=ALL --relocatable

you see the following running in your terminal:

/usr/bin/perl Configure.pl --prefix=/usr --make-install --git-protocol=https --relocatable --no-ignore-errors --silent-build --no-force-rebuild --backends=moar,jvm,js --gen-moar

The dependencies for this will be

apt-get install gcc g++ \
        libc6-dev \
        libencode-perl \
        wget \
        libzstd-dev \
        default-jdk \
        nodejs \
        npm \
        make

If Javascript backend can be successfully built by resolving npm link issue above, I am sure all backends: moar, jvm and javascript can be built.

So the issue left here is how to npm link while building rakudo. Hope somebody's expert help will resolve this issue.

like image 70
Suman Khanal Avatar answered Oct 16 '22 13:10

Suman Khanal