macos - 带 xs 的 Perl 模块 Config::Augeas 不会安装在 Big Sur 上

标签 macos perl augeas

在配备 Catalina (10.15.6) 的 iMac 上,我安装了 augeas brew 软件包,然后安装了 perl 模块“Config::Augeas”,没有出现任何问题。在大苏尔,我没有取得同样的成功。安装brew包然后执行“cpanm Config::Augeas”后,我在构建日志中得到以下输出:

 27 Building Config-Augeas
 28 cc -I/Users/me/perl5/perlbrew/perls/perl-5.32.1/lib/5.32.1/darwin-2level/CORE -DVERSION="1.000" -DXS_VERSION="1.000" -I/usr/local/Cellar/augeas/1.12.0/include -Wall -Wformat -Werror=format-security -c -fno-common -DPERL_DARWIN -mmacosx-version-min=11.2 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -O3 -o lib/Config/Augeas.o lib/Config/Augeas.c
 29 ExtUtils::Mkbootstrap::Mkbootstrap('blib/arch/auto/Config/Augeas/Augeas.bs')
 30 cc -mmacosx-version-min=11.2 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong -o blib/arch/auto/Config/Augeas/Augeas.bundle lib/Config/Augeas.o -L/usr/local/Cellar/augeas/1.12.0/lib -laugeas
 31 Can't call method "get" on an undefined value at /Users/me/.cpanm/work/1615471944.29922/Config-Augeas-1.000/blib/lib/Config/Augeas.pm line 227.
 32 # Looks like your test exited with 255 just after 2.
 33 t/Config-Augeas.t ...
 34 Dubious, test returned 255 (wstat 65280, 0xff00)
 35 Failed 28/30 subtests
 36
 37 #   Failed test 'Created new Augeas object without backup file'
 38 #   at t/Config-AugeasC.t line 76.
 39 Can't call method "set" on an undefined value at t/Config-AugeasC.t line 78.
 40 # Looks like your test exited with 255 just after 4.
 41 t/Config-AugeasC.t ..
 42 Dubious, test returned 255 (wstat 65280, 0xff00)
 43 Failed 29/32 subtests
 44 Can't stat config-model-edit: No such file or directory
 45  at /Users/me/perl5/perlbrew/perls/perl-5.32.1/lib/site_perl/5.32.1/Test/Pod.pm line 223.
 46 t/pod.t ............. ok

两台机器都运行 perlbrew(尽管 perl 版本不同)。我不认为 perl 的版本是问题所在,更有可能是 Big Sur 做了一些 perl 模块不喜欢的更改。有什么想法吗?

最佳答案

问题是a buglibtool这会导致动态库被编译为 a flat namespace 。这再次导致共享库 libSystem.B.dylib 和 libfa.1.dylib 中两个同名符号之间发生冲突。这两个库都声明了一个名为 hash_create() 的符号,但是 Perl 模块需要将该符号解析为 libfa.1.dyliblibSystem.B.dylib code> 始终在 libfa.1.dylib 之前加载,因此使用了错误版本的 hash_create()

这个问题以前遇到过,见this问题。进一步的解释可以参见 here .

自从修复bug以来由于libtool还没有作为新版本的libtool发布,这个问题并不是简单地通过升级xcode命令行工具就能解决的。相反,您可以尝试下载 libaugeas source并从源代码编译:

$ brew uninstall augeas
$ wget http://download.augeas.net/augeas-1.12.0.tar.gz
$ cd augeas-1.12.0
$ MACOSX_DEPLOYMENT_TARGET=10.15 ./configure
$ make
$ make install

注意:通过在上述命令中指定 MACOSX_DEPLOYMENT_TARGET=10.15,我们可以解决该错误,因此无需修补configure

Perl 模块现在应该可以正常安装了。

另一种解决方法:您可以使用 dynamic linking (而不是 dynamic loading )用于 libfa.1.dylib。为了实现这一目标,我rewrote moduleExtUtils::MakeMaker而不是Module::Build 。接下来要使用动态链接安装,您可以执行以下操作:

git clone https://github.com/hakonhagland/Config-Augeas-MM.git
cd https://github.com/hakonhagland/Config-Augeas-MM.git
perl Makefile.PL
make perl
make -f Makefile.aperl inst_perl MAP_TARGET=perl

注意:最后一个命令会覆盖现有的 Perl 二进制文件,因此请小心,请参阅 this link了解更多信息。

现在,模块可以测试并成功安装了:

$ make test
"/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Augeas.bs blib/arch/auto/Config/Augeas/Augeas.bs 644
rm -f blib/arch/auto/Config/Augeas/Augeas.bundle
LD_RUN_PATH="/usr/local/lib" cc  -mmacosx-version-min=11.1 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong  Augeas.o  -o blib/arch/auto/Config/Augeas/Augeas.bundle  \
       -L/usr/local/lib -laugeas   \

chmod 755 blib/arch/auto/Config/Augeas/Augeas.bundle
PERL_DL_NONLAZY=1 "/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Config-Augeas.t ... ok
t/Config-AugeasC.t .. ok
t/pod.t ............. skipped: Test::Pod 1.00 required for testing POD
All tests successful.
Files=3, Tests=62,  7 wallclock secs ( 0.04 usr  0.02 sys +  5.71 cusr  0.50 csys =  6.27 CPU)
Result: PASS

$ make install
"/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Augeas.bs blib/arch/auto/Config/Augeas/Augeas.bs 644
Manifying 1 pod document
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/darwin-2level/auto/Config/Augeas/extralibs.all
Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/darwin-2level/auto/Config/Augeas/Augeas.a
Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/darwin-2level/auto/Config/Augeas/extralibs.ld
Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/darwin-2level/auto/Config/Augeas/Augeas.bundle
Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/darwin-2level/Config/Augeas.pm
Installing /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/man/man3/Config::Augeas.3
Appending installation info to /Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/lib/5.32.0/darwin-2level/perllocal.pod

$ perl -MConfig::Augeas -E 'say $INC{"Config/Augeas.pm"}'
/Users/hakonhaegland/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/darwin-2level/Config/Augeas.pm

关于macos - 带 xs 的 Perl 模块 Config::Augeas 不会安装在 Big Sur 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66584327/

相关文章:

macos - 当我打开 zsh 时,一些奇怪的字符显示为我的提示符(OSX 上的 oh-my-zsh)

macos - 切换到终端以获得 Octave GUI 输出

windows - 如何在 Windows 上调试 Perl XS 代码

perl - 对扩展名指定的多个输入文件执行单行

perl - 关于foreach值的问题

xml - 如何使用 Augeas 更新现有的或创建新的 XML 节点

xml - Puppet Augeas - 无法更新包含 CDATA 的 xml 节点中的值

tomcat - 如何修复 Tomcat list 的 Augeas 依赖性?

java - 在 Mac 上设置 IntelliJ IDEA 平台插件 SDK

c++ - OS X 选择 llvm gcc 编译器