latexindent:自 macOS 11 Big Sur 以来安装 File::HomeDir、Mac::SystemDirectory 时遇到问题

Posted

技术标签:

【中文标题】latexindent:自 macOS 11 Big Sur 以来安装 File::HomeDir、Mac::SystemDirectory 时遇到问题【英文标题】:latexindent: trouble installing File::HomeDir, Mac::SystemDirectory since macOS 11 Big Sur 【发布时间】:2021-04-02 17:48:38 【问题描述】:

在开始之前,我应该指出我在 macOS 10.15 Catalina 上从未遇到过这个问题,很遗憾,this 类似线程中的回复并没有解决问题。

我在全新安装的 macOS 11 Big Sur 上尝试使用latexindent,但遇到File:HomeDir 的问题:运行latexindent 会返回一个完整的错误列表,以Can't locate File/HomeDir.pm in @INC 开头。我尝试使用cpan 安装该模块,但最终得到以下结果:

Reading '/Users/myname/.cpan/Metadata'
  Database was generated on Thu, 24 Dec 2020 05:41:03 GMT
Running install for module 'File::HomeDir'
Checksum for /Users/myname/.cpan/sources/authors/id/R/RE/REHSACK/File-HomeDir-1.006.tar.gz ok
Scanning cache /Users/myname/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring R/RE/REHSACK/File-HomeDir-1.006.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite Mac::SystemDirectory 0.04 not found.
Generating a Unix-style Makefile
Writing Makefile for File::HomeDir
Writing MYMETA.yml and MYMETA.json
  REHSACK/File-HomeDir-1.006.tar.gz
  /usr/bin/perl Makefile.PL -- OK
Running make for R/RE/REHSACK/File-HomeDir-1.006.tar.gz
---- Unsatisfied dependencies detected during ----
----     REHSACK/File-HomeDir-1.006.tar.gz    ----
    Mac::SystemDirectory [requires]
Running install for module 'Mac::SystemDirectory'
Checksum for /Users/myname/.cpan/sources/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz ok
Configuring E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz with Makefile.PL
HASCOMPILERjIOx/TESTn6oE.c:2:10: fatal error: 'EXTERN.h' file not found
#include "EXTERN.h"
         ^~~~~~~~~~
1 error generated.
Couldn't execute cc  -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -Os "-I/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE"   -c HASCOMPILERjIOx/TESTn6oE.c -o HASCOMPILERjIOx/TESTn6oE.o: Inappropriate ioctl for device at Makefile.PL line 14.
Requires a compiler
Warning: No success on command[/usr/bin/perl Makefile.PL]
  ETHER/Mac-SystemDirectory-0.13.tar.gz
  /usr/bin/perl Makefile.PL -- NOT OK
  REHSACK/File-HomeDir-1.006.tar.gz
  Has already been unwrapped into directory /Users/myname/.cpan/build/File-HomeDir-1.006-2
  REHSACK/File-HomeDir-1.006.tar.gz
  Has already been prepared
Running make for R/RE/REHSACK/File-HomeDir-1.006.tar.gz
Warning: Prerequisite 'Mac::SystemDirectory => 0.04' for 'REHSACK/File-HomeDir-1.006.tar.gz' failed when processing 'ETHER/Mac-SystemDirectory-0.13.tar.gz' with 'writemakefile => NO '/usr/bin/perl Makefile.PL' returned status 6400'. Continuing, but chances to succeed are limited.
cp lib/File/HomeDir/Driver.pm blib/lib/File/HomeDir/Driver.pm
cp lib/File/HomeDir/MacOS9.pm blib/lib/File/HomeDir/MacOS9.pm
cp lib/File/HomeDir/Darwin/Carbon.pm blib/lib/File/HomeDir/Darwin/Carbon.pm
cp lib/File/HomeDir/Darwin/Cocoa.pm blib/lib/File/HomeDir/Darwin/Cocoa.pm
cp lib/File/HomeDir/Windows.pm blib/lib/File/HomeDir/Windows.pm
cp lib/File/HomeDir/FreeDesktop.pm blib/lib/File/HomeDir/FreeDesktop.pm
cp lib/File/HomeDir.pm blib/lib/File/HomeDir.pm
cp lib/File/HomeDir/Test.pm blib/lib/File/HomeDir/Test.pm
cp lib/File/HomeDir/Darwin.pm blib/lib/File/HomeDir/Darwin.pm
cp lib/File/HomeDir/Unix.pm blib/lib/File/HomeDir/Unix.pm
Manifying 10 pod documents
  REHSACK/File-HomeDir-1.006.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t xt/*.t
t/01_compile.t ........ 1/11 # Implemented by: File::HomeDir::Darwin
t/01_compile.t ........ ok     
t/02_main.t ........... # $<: 501 -- $(: 20 20 12 61 79 80 81 98 701 33 100 204 250 395 398 399 400
t/02_main.t ........... ok     
t/10_test.t ........... ok     
t/11_darwin.t ......... ok   
t/12_darwin_carbon.t .. skipped: Not running on 32-bit Darwin
t/13_darwin_cocoa.t ... skipped: Not running on Darwin with Cocoa API using Mac::SystemDirectory
t/20_empty_home.t ..... ok   
All tests successful.
Files=7, Tests=90,  1 wallclock secs ( 0.04 usr  0.01 sys +  0.48 cusr  0.13 csys =  0.66 CPU)
Result: PASS
  REHSACK/File-HomeDir-1.006.tar.gz
Tests succeeded but one dependency not OK (Mac::SystemDirectory)
  REHSACK/File-HomeDir-1.006.tar.gz
  [dependencies] -- NA
Failed during this command:
 ETHER/Mac-SystemDirectory-0.13.tar.gz        : writemakefile NO '/usr/bin/perl Makefile.PL' returned status 6400
 REHSACK/File-HomeDir-1.006.tar.gz            : make_test NO one dependency not OK (Mac::SystemDirectory)

我真的不太了解 perl,但在我看来,Mac::SystemDirectory 不见了,但是当我尝试安装它时,我得到了

Reading '/Users/myname/.cpan/Metadata'
  Database was generated on Thu, 24 Dec 2020 05:41:03 GMT
Running install for module 'Mac::SystemDirectory'
Checksum for /Users/myname/.cpan/sources/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz ok
Scanning cache /Users/myname/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring E/ET/ETHER/Mac-SystemDirectory-0.13.tar.gz with Makefile.PL
HASCOMPILER5Emh/TESTS3W7.c:2:10: fatal error: 'EXTERN.h' file not found
#include "EXTERN.h"
         ^~~~~~~~~~
1 error generated.
Couldn't execute cc  -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -Os "-I/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE"   -c HASCOMPILER5Emh/TESTS3W7.c -o HASCOMPILER5Emh/TESTS3W7.o: Inappropriate ioctl for device at Makefile.PL line 14.
Requires a compiler
Warning: No success on command[/usr/bin/perl Makefile.PL]
  ETHER/Mac-SystemDirectory-0.13.tar.gz
  /usr/bin/perl Makefile.PL -- NOT OK
Failed during this command:
 ETHER/Mac-SystemDirectory-0.13.tar.gz        : writemakefile NO '/usr/bin/perl Makefile.PL' returned status 6400

从这里看来,一个头文件EXTERN.h 丢失了,但我不确定从这里去哪里。有没有人有任何想法或建议?我为巨大的代码块道歉——我认为最好包括所有可能的细节。非常感谢!

注意:我发布了这个 same question in the LaTeX Stack Exchange,但我想我也会在这里问,因为它似乎是一个更广泛的 perl 问题。

【问题讨论】:

EXTERN.h 是 Perl 的一部分。但是您的发行版(Apple)可能已拒绝将其包含在内。也许你需要安装一个包? 目前在 Big Sur 上构建尝试链接到外部库的模块存在问题,但这似乎不相关。 您使用的是哪个版本的perl?输入which perl; perl --version。如果您使用的是系统 perl,也许您可​​以尝试使用 perlbrew 安装 perl 5.32?我想你会得到EXTERN.h 标头 好像是ExtUtils::HasCompiler 失败了,我在他们的问题跟踪器中添加了一个issue 临时修复似乎是明确设置包含搜索路径:export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE:$CPATH 然后运行sudo cpan Mac::SystemDirectory 【参考方案1】:

总结对我有用的解决方案:问题是在 macOS 11 Big Sur 中,EXTERN.h 默认不在 CPATH 上。要解决此问题,请将包含EXTERN.h 的目录添加到CPATH

export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE:$CPATH

然后打开cpan shell(只需输入cpan然后进入命令行)并输入install Mac::SystemDirectory。此过程完成后,我还可以安装 File:HomeDir 和其他一些模块,以使 latexindent 正常工作。

注意:在执行此操作之前,我必须设置 cpan;只需打开外壳并按照说明操作就足够了。

非常感谢Håkon Hægland 的解决方案!

【讨论】:

对我来说,路径/Library/Developer/CommandLineTools/SDKs/ 不存在(CommandLineTools 中的唯一目录是usr/share/man)。我不知道从那里去哪里。我试过brew install perl,但它没有创建那个目录。我的perl --version 是 v5.28.2。 你跑xcode-select --install了吗?我认为应该填充CommandLineTools 目录。 完美,非常感谢!我认为这让我克服了这个特殊问题。

以上是关于latexindent:自 macOS 11 Big Sur 以来安装 File::HomeDir、Mac::SystemDirectory 时遇到问题的主要内容,如果未能解决你的问题,请参考以下文章

latexindent:未知的 PerlIO 层“编码”-格式化失败,退出代码为 255 macOS 12 Monterey

在 macOS 11.3 上找不到“gl.h”

使用 Xcode 将自定义字体捆绑到 macOS 独立应用程序中

Power BI 中动态变化的排名列

有没有办法让拖尾的滑动操作像 macOS 11.0 一样具有圆角?

power bi怎么排序?power bi自定义排序啊?求教程