如何解决Perl 模块 Config::Augeas with xs 不会安装在 Big Sur 上
在带有 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,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 bug 中的 libtool,导致动态库使用 a flat namespace 进行编译。这再次导致共享库 libSystem.B.dylib
和 libfa.1.dylib
中具有相同名称的两个符号之间发生冲突。两个库都声明了一个名为 hash_create()
的符号,但是 Perl 模块需要将符号解析为 libfa.1.dylib
,但是 libSystem.B.dylib
总是在 libfa.1.dylib
和错误版本的 {{1} 之前加载因此使用}}。
之前遇到过这个问题,见this问题。可以在 here 中找到进一步的解释。
由于对 hash_create()
中的 bug 的修复尚未作为 libtool
的新版本发布,因此问题并不能简单地通过升级 xcode 命令行工具来解决。相反,您可以尝试下载 libaugeas source 并从源代码编译:
libtool
注意:通过在上述命令中指定 $ 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
。
Perl 模块现在应该可以正常安装了。
另一种解决方法:您可以对 configure
使用 dynamic linking(而不是 dynamic loading)。为了实现这一点,我将 rewrote module 改为 ExtUtils::MakeMaker 而不是 Module::Build。接下来使用动态链接安装,您可以:
libfa.1.dylib
注意:最后一个命令会覆盖您现有的 perl 二进制文件,所以要小心,请参阅 this link 了解更多信息。
现在可以测试安装成功了:
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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。