`Missing or wrong version of dependency` after recompiling nqp
Asked Answered
A

1

6

I am trying to learn myself how to debug rakudo and nqp. So this is my first attempt:

cd $HOME/debug
git clone https://github.com/rakudo/rakudo.git
cd rakudo
perl Configure.pl --gen-moar --gen-nqp --backends=moar
make
make install # installs into ./install/bin
export PATH=${PWD}/install/bin:$PATH
export PATH=${PWD}/install/share/perl6/site/bin:$PATH
# Testing executable:
perl6 --version
# This is Rakudo version 2018.12-256-g9517c3779 built on MoarVM version 2018.12-36-g34fac5f4e
# implementing Perl 6.d.
# 
# Now modifying an nqp file:
cd nqp
# Change a file: E.g. : vim src/HLL/Compiler.nqp
# I added a line after line 293 in src/HLL/Compiler.nqp:
#   nqp::say("*** Debugging message: HLL::Compiler::command_eval() ***");
# and save it
make
make install
# Testing perl6 again..
perl6 --version

The last command now gives the following exception:

Unhandled exception: Missing or wrong version of dependency 'gen/moar/stage2/NQPHLL.nqp' (from 'src/Perl6/Pod.nqp')
   at <unknown>:1  (/home/hakon/debug/rakudo/install/share/nqp/lib/Perl6/Pod.moarvm:<dependencies+deserialize>)
 from src/vm/moar/ModuleLoader.nqp:47  (/home/hakon/debug/rakudo/install/share/nqp/lib/ModuleLoader.moarvm:)
 from src/vm/moar/ModuleLoader.nqp:40  (/home/hakon/debug/rakudo/install/share/nqp/lib/ModuleLoader.moarvm:load_module)
 from <unknown>:1  (/home/hakon/debug/rakudo/install/share/nqp/lib/Perl6/Actions.moarvm:<dependencies+deserialize>)
 from src/vm/moar/ModuleLoader.nqp:47  (/home/hakon/debug/rakudo/install/share/nqp/lib/ModuleLoader.moarvm:)
 from src/vm/moar/ModuleLoader.nqp:40  (/home/hakon/debug/rakudo/install/share/nqp/lib/ModuleLoader.moarvm:load_module)
 from <unknown>:1  (/home/hakon/debug/rakudo/install/share/nqp/lib/Perl6/Grammar.moarvm:<dependencies+deserialize>)
 from src/vm/moar/ModuleLoader.nqp:47  (/home/hakon/debug/rakudo/install/share/nqp/lib/ModuleLoader.moarvm:)
 from src/vm/moar/ModuleLoader.nqp:40  (/home/hakon/debug/rakudo/install/share/nqp/lib/ModuleLoader.moarvm:load_module)
 from <unknown>:1  (/home/hakon/debug/rakudo/install/share/perl6/runtime/perl6.moarvm:<dependencies+deserialize>)
h

So I thought, maybe I need to run make on rakudo also:

cd ..
make

but here make fails with:

/home/hakon/perlbrew/perls/perl-5.29.3/bin/perl5.29.3 tools/build/check-nqp-version.pl /home/hakon/debug/rakudo/install/bin/nqp-m
/home/hakon/debug/rakudo/install/bin/nqp-m tools/build/gen-cat.nqp moar src/vm/moar/ModuleLoaderVMConfig.nqp src/Perl6/ModuleLoader.nqp > gen/moar/ModuleLoader.nqp
/home/hakon/debug/rakudo/install/bin/nqp-m --module-path=blib --target=mbc --output=blib/Perl6/ModuleLoader.moarvm \
    gen/moar/ModuleLoader.nqp
*** Debugging message: HLL::Compiler::command_eval() ***
Confused at line 2, near "*** Debugg"
   at gen/moar/stage2/NQPHLL.nqp:811  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:panic)
 from gen/moar/stage2/NQP.nqp:921  (/home/hakon/debug/rakudo/install/share/nqp/lib/nqp.moarvm:comp_unit)
 from gen/moar/stage2/NQP.nqp:782  (/home/hakon/debug/rakudo/install/share/nqp/lib/nqp.moarvm:TOP)
 from gen/moar/stage2/QRegex.nqp:2300  (/home/hakon/debug/rakudo/install/share/nqp/lib/QRegex.moarvm:parse)
 from gen/moar/stage2/NQPHLL.nqp:2031  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:parse)
 from gen/moar/stage2/NQPHLL.nqp:1951  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:execute_stage)
 from gen/moar/stage2/NQPHLL.nqp:1984  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:run)
 from gen/moar/stage2/NQPHLL.nqp:1976  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:)
 from gen/moar/stage2/NQPHLL.nqp:1971  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:compile)
 from gen/moar/stage2/NQPHLL.nqp:1666  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
 from gen/moar/stage2/NQPHLL.nqp:1889  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
 from gen/moar/stage2/NQPHLL.nqp:1849  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1773  (/home/hakon/debug/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
 from gen/moar/stage2/NQP.nqp:4135  (/home/hakon/debug/rakudo/install/share/nqp/lib/nqp.moarvm:MAIN)
 from gen/moar/stage2/NQP.nqp:1  (/home/hakon/debug/rakudo/install/share/nqp/lib/nqp.moarvm:<mainline>)
 from <unknown>:1  (/home/hakon/debug/rakudo/install/share/nqp/lib/nqp.moarvm:<main>)
 from <unknown>:1  (/home/hakon/debug/rakudo/install/share/nqp/lib/nqp.moarvm:<entry>)
make: *** [Makefile:457: blib/Perl6/ModuleLoader.moarvm] Error 1
Absurdity answered 25/1, 2019 at 19:43 Comment(2)
Start by deleting every .precomp directory.Ilo
@BradGilbert Thanks for the advice, I deleted /home/hakon/debug/rakudo/lib/.precomp but I still get the same error.Kurtiskurtosis
K
7

A Rakudo build is statically "linked" against libraries in the NQP build used to produce it, and therefore Rakudo will need to be rebuilt after modifying NQP. Hashing is used to ensure that the wrong version of a dependency is never used; if this situation was not detected, there's a high chance of extremely strange failure modes.

The second failure is because the Rakudo build uses some NQP scripts to preprocess some source files, which are then fed to the NQP of Perl 6 compiler. It uses > to redirect the output into a file. Therefore, your debug output will be redirected into that file, and then - since it is not valid source code - cause a build error. The solution is to always produce debug output on stderr instead, for example using note.

Kick answered 25/1, 2019 at 22:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.