6

我正在尝试学习如何调试rakudonqp。所以这是我的第一次尝试:

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

最后一个命令现在给出以下异常:

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

所以我想,也许我还需要make在 rakudo 上运行:

cd ..
make

但这里make失败了:

/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
4

1 回答 1

7

Rakudo 构建与用于生成它的 NQP 构建中的库静态“链接”,因此在修改 NQP 后需要重新构建 Rakudo。散列用于确保永远不会使用错误版本的依赖项;如果没有检测到这种情况,则极有可能出现极其奇怪的故障模式。

第二个失败是因为 Rakudo 构建使用一些 NQP 脚本来预处理一些源文件,然后将其馈送到 Perl 6 编译器的 NQP。它用于>将输出重定向到文件中。因此,您的调试输出将被重定向到该文件,然后 - 因为它不是有效的源代码 - 导致构建错误。解决方案是始终在 stderr 上生成调试输出,例如使用note.

于 2019-01-25T22:36:58.407 回答