“…/auto/List/Util/Util.so: undefined symbol: PL_stack_sp at …/XSLoader.pm”仅当 运行 测试套件与 CGI::Test _and_ on Travis CI

"…/auto/List/Util/Util.so: undefined symbol: PL_stack_sp at …/XSLoader.pm" only when running test suite with CGI::Test _and_ on Travis CI

我有一个名为 CGI::Github::Webhook whose test suite works fine on Travis CI so far on the branch master. But since it's a module for writing CGI scripts, I wanted to test it with CGI::Test 的 Perl 模块,因为它更接近现实生活场景。

但是every Travis CI run in the branch cgi-test failed so far。除了 Perl 5.24 及更高版本的 运行s 之外,每个失败的 运行 都包含这些行,只是路径中的 Perl 版本号不同:

Attempt to reload List/Util.pm aborted.
Compilation failed in require at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Sub/Exporter/Progressive.pm line 9.
BEGIN failed--compilation aborted at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Sub/Exporter/Progressive.pm line 9.
Compilation failed in require at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Devel/GlobalDestruction.pm line 11.
BEGIN failed--compilation aborted at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Devel/GlobalDestruction.pm line 11.
Compilation failed in require at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Moo/_Utils.pm line 21.
BEGIN failed--compilation aborted at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Moo/_Utils.pm line 21.
Compilation failed in require at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Moo.pm line 4.
BEGIN failed--compilation aborted at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/Moo.pm line 4.
Compilation failed in require at /home/travis/build/xtaran/CGI-Github-Webhook/build_dir/lib/CGI/Github/Webhook.pm line 11.
BEGIN failed--compilation aborted at /home/travis/build/xtaran/CGI-Github-Webhook/build_dir/lib/CGI/Github/Webhook.pm line 11.
Compilation failed in require at ./cgitest.pl line 10.
BEGIN failed--compilation aborted at ./cgitest.pl line 10.
script /cgi-bin/cgitest.pl generated no valid headers at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/CGI/Test.pm line 468.
Use of uninitialized value $in_fname in unlink at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/CGI/Test.pm line 469.
Use of uninitialized value $in_fname in concatenation (.) or string at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/CGI/Test.pm line 469.
can't unlink : No such file or directory at /home/travis/perl5/perlbrew/perls/5.22.0/lib/site_perl/5.22.0/CGI/Test.pm line 469.

示例取自 currently latest run under Perl 5.22。 Perl 5.24 上的症状大致相同,只是初始错误消息的措辞不同。

有人知道这里出了什么问题吗?我什至有机会解决这个问题吗?对我来说看起来像个错误。但是在哪个模块中?我没有找到匹配的错误报告 against CGI-Test, Scalar-List-Utils or XSLoader,但我希望这样的问题已经被报告过,因为它似乎不是新问题。 (几个月前第一次注意到。)

如果我 运行 在 Debian Unstable(当前 Perl 版本 5.22)上使用系统提供的 Perl 和 Perl 模块测试套件,它并没有失败,所以我无法在本地重现问题。

我自己找到的:这是我在测试套件中的示例 CGI 脚本中的 #!/usr/bin/perl shebang 行(and/or 可能也是 t/cgi-test.t 中的相同 shebang 行)。

Changing them to #!/usr/bin/env perl fixed the issue,即测试的 CGI 脚本是 运行 系统 perl 而不是 perlbrew 安装的