Macos Perl模块配置::带有xs-won';t安装在大苏尔

Macos Perl模块配置::带有xs-won';t安装在大苏尔,macos,perl,augeas,Macos,Perl,Augeas,在我的iMac with Catalina(10.15.6)上,我安装了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-2

在我的iMac with Catalina(10.15.6)上,我安装了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模块不喜欢的一些更改。有什么想法吗?

问题在于,动态库是如何编译的。这再次导致共享库
libSystem.B.dylib
libfa.1.dylib
中具有相同名称的两个符号之间发生冲突。两个库都声明了一个名为
hash_create()
的符号,但是Perl模块需要将该符号解析为
libfa.1.dylib
,但是
libSystem.B.dylib
总是在
libfa.1.dylib
之前加载,因此使用了错误版本的
hash_create()

以前遇到过此问题,请参阅问题。可以找到进一步的解释

由于
libtool
中的修复程序尚未作为
libtool
的新版本发布,因此,升级xcode命令行工具并不能简单地解决此问题。相反,您可以尝试下载libaugeas并从源代码处编译:

$ 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\u DEPLOYMENT\u TARGET=10.15
,我们可以解决这个bug,因此不必修补
configure

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

另一种解决方法:您可以使用(而不是)for
libfa.1.dylib
。为了实现这一点,我选择了,而不是。接下来要使用动态链接进行安装,您可以执行以下操作:

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二进制文件,因此请小心,有关更多信息,请参阅

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

$ 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

为了排除perlbrew的任何问题,我在一台旧的mac上干净地安装了Big Sur,并尝试在没有perlbrew的情况下安装,但遇到了相同的问题。是的,我在这里也看到了问题(macOS 11.2,perlbrew perl 5.32)。我可以看出考试失败了。问题似乎是它在。。。。。。其中at调用XS文件中的
aug_init()
。此函数似乎返回未定义的值。我正在研究可能的问题。如果我直接从C调用
aug\u init()
,它会工作(它不会返回NULL)。我使用了测试程序,并使用
cc`pkg config--cflags augeas``pkg config--libs augeas`-o anew.c
编译。因此,我的猜测是,问题与perl在运行时加载共享库
libaugeas.dylib
有关(间接通过perl生成的Augeas.bundle),而测试C程序是使用静态库
libaugeas.a
编译的。。。我正在调查这个补丁有更多的细节:哇,真棒的工作!我一有机会就试试看。也许几天之后我就被一大堆工作缠住了。太好了!添加了一个用于通知问题作者的。