perl installation, cpan install true.pm fails

329 views Asked by At

I am very much a perl newbie, I know very little about the system.

I am trying to install App/Lingua/BO/Wylie/Transliteration.pm which seems to be dependent on true.

I am getting an error on the install of true. This seems very surprising, so I am very open to something very fundamental and wrong with the perl installation. Running perl v5.30.2 on MacOS 11.3.1.

cpan error log:

force install true.pm                                                         
Running install for module 'true'
  CHOCOLATE/true-v1.0.2.tar.gz
  Has already been unwrapped into directory /Users/phil/.cpan/build/true-v1.0.2-0
  CHOCOLATE/true-v1.0.2.tar.gz
  Has already been prepared
Running make for C/CH/CHOCOLATE/true-v1.0.2.tar.gz
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- true.bs blib/arch/auto/true/true.bs 644
cc -c  -I/Users/phil/perl5/lib/perl5/darwin-thread-multi-2level/B/Hooks/OP/Annotation/Install -I/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/B/Hooks/OP/Check/Install -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -O3 -Wall -W   -DVERSION=\"v1.0.2\" -DXS_VERSION=\"v1.0.2\"  -iwithsysroot "/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE"   true.c
true.xs:8:10: fatal error: 'hook_op_check.h' file not found
#include "hook_op_check.h"
         ^~~~~~~~~~~~~~~~~
1 error generated.
make: *** [true.o] Error 1
  CHOCOLATE/true-v1.0.2.tar.gz
  /usr/bin/make -- NOT OK
Failed during this command:
 CHOCOLATE/true-v1.0.2.tar.gz                 : make NO
1

There are 1 answers

0
Håkon Hægland On

true.xs:8:10: fatal error: 'hook_op_check.h' file not found

This looks like a bug in the system Perl installation that comes preinstalled on macOS. The module B::Hooks::OP::Check comes preinstalled in /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/B/Hooks/OP/ but the file /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/B/Hooks/OP/Check/Install/hook_op_check.h is missing for some reason. As a consequence, it is not possible to install the module true which depends on that file being there.

You can override the preinstalled version by running:

$ cpan -f B::Hooks::OP::Check

This will install the module into /Library/Perl/5.30/darwin-thread-multi-2level/B/Hooks/OP if you are using sudo with cpan, or into ~/perl5/lib/perl5/darwin-thread-multi-2level/B/Hooks/OP if you are using local::lib with cpan. This latter installation will be found before the preinstalled version due to the ordering of the perl @INC include path, so it will override the preinstalled version of the module.

This will enable you to install the module true, but after installing this the installation of App::Lingua::BO::Wylie::Transliteration still fails:

$ cpan App::Lingua::BO::Wylie::Transliteration
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/hakonhaegland/.cpan/Metadata'
  Database was generated on Sat, 01 Jan 2022 22:29:03 GMT
Running install for module 'App::Lingua::BO::Wylie::Transliteration'
Fetching with LWP:
http://www.cpan.org/authors/id/D/DB/DBR/App-Lingua-BO-Wylie-Transliteration-0.1.0.tar.gz
Fetching with LWP:
HASH(0x13444b3c8)authors/id/D/DB/DBR/CHECKSUMS
Fetching with LWP:
HASH(0x13444b3c8)authors/id/D/DB/DBR/CHECKSUMS.gz
Fetching with LWP:
http://www.cpan.org/authors/id/D/DB/DBR/CHECKSUMS
Checksum for /Users/hakonhaegland/.cpan/sources/authors/id/D/DB/DBR/App-Lingua-BO-Wylie-Transliteration-0.1.0.tar.gz ok
Configuring D/DB/DBR/App-Lingua-BO-Wylie-Transliteration-0.1.0.tar.gz with Build.PL
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'App-Lingua-BO-Wylie-Transliteration' version '0.1.0'
  DBR/App-Lingua-BO-Wylie-Transliteration-0.1.0.tar.gz
  /usr/bin/perl Build.PL -- OK
Running Build for D/DB/DBR/App-Lingua-BO-Wylie-Transliteration-0.1.0.tar.gz
Building App-Lingua-BO-Wylie-Transliteration
  DBR/App-Lingua-BO-Wylie-Transliteration-0.1.0.tar.gz
  ./Build -- OK
Running Build test for DBR/App-Lingua-BO-Wylie-Transliteration-0.1.0.tar.gz
t/00-check-deps.t ........ ok
t/00-load.t .............. 1/1
#   Failed test 'use App::Lingua::BO::Wylie::Transliteration;'
#   at /Library/Perl/5.30/Test/UseAllModules.pm line 71.
#     Tried to use 'App::Lingua::BO::Wylie::Transliteration'.
#     Error:  Couldn't find declarator 'method' at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/Devel/Declare/Context/Simple.pm line 47.
#   Devel::Declare::Context::Simple::skip_declarator(Method::Signatures::Simple=HASH(0x12704f6d8)) called at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/Devel/Declare/MethodInstaller/Simple.pm line 62
#   Devel::Declare::MethodInstaller::Simple::parser(Method::Signatures::Simple=HASH(0x12704f6d8), "method", 0, 1) called at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/Devel/Declare/MethodInstaller/Simple.pm line 25
#   Devel::Declare::MethodInstaller::Simple::__ANON__("method", 0) called at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/Devel/Declare.pm line 277
#   Devel::Declare::linestr_callback("const", "method", 0) called at lib/App/Lingua/BO/Wylie/Transliteration.pm line 37
#   require App/Lingua/BO/Wylie/Transliteration.pm called at /Library/Perl/5.30/Test/UseAllModules.pm line 71
#   Test::UseAllModules::BEGIN() called at lib/App/Lingua/BO/Wylie/Transliteration.pm line 37
#   eval {...} called at lib/App/Lingua/BO/Wylie/Transliteration.pm line 37
#   eval 'package Test::UseAllModules;
# BEGIN { ${^WARNING_BITS} = $args[-1] if defined $args[-1] }
# #line 71 /Library/Perl/5.30/Test/UseAllModules.pm
# use App::Lingua::BO::Wylie::Transliteration @{$args[0]};
# 1;
# ' called at /System/Library/Perl/5.30/Test/More.pm line 1034
#   Test::More::_eval("package Test::UseAllModules;\x{a}BEGIN { \${^WARNING_BITS} = \$args"..., ARRAY(0x1268938e0), "UUUUUUUUUUUUUUUUUUU") called at /System/Library/Perl/5.30/Test/More.pm line 1009
#   Test::More::use_ok("App::Lingua::BO::Wylie::Transliteration") called at /Library/Perl/5.30/Test/UseAllModules.pm line 71
#   Test::UseAllModules::all_uses_ok() called at t/00-load.t line 4
#   main::BEGIN() called at lib/App/Lingua/BO/Wylie/Transliteration.pm line 37
#   eval {...} called at lib/App/Lingua/BO/Wylie/Transliteration.pm line 37
# Compilation failed in require at /Library/Perl/5.30/Test/UseAllModules.pm line 71.
# BEGIN failed--compilation aborted at /Library/Perl/5.30/Test/UseAllModules.pm line 71.
Bailout called.  Further testing stopped:  failed: App::Lingua::BO::Wylie::Transliteration

this is due to a recent change in Devel::Declare and a corresponding change in the parser in bleed described in these bug reports, report1 and report2.

A workaround is to install a an earlier version of perl together with an earlier version of Devel::Declare. You can do this using perlbrew. For example:

$ perlbrew install perl-5.26.3
$ cpanm Devel::[email protected]
$ cpanm App::Lingua::BO::Wylie::Transliteration