简体   繁体   中英

Perl LibXLST failing on Mac OS Big Sur 11.4

I'm having trouble with a Perl application that fails with an LibXSLT-related error on Mac OS Big Sur 11.4 on multiple computers (all Intel Macs) - it worked correctly before the Mac OS upgrade, and now seems to fail on a freshly installed up-to date Mac.

The error message for a minimal script perl -MXML::LibXSLT -E 'say $INC{"XML/LibXSLT.pm"}' (using system perl - no other perl is installed on the machine) is as follows:

Can't load '/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/auto/XML/LibXSLT/LibXSLT.bundle' for module XML::LibXSLT: dlopen(/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/auto/XML/LibXSLT/LibXSLT.bundle, 0x0001): symbol '_xsltLibxsltVersion' not found, expected in flat namespace by '/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/auto/XML/LibXSLT/LibXSLT.bundle' at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197. at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/XML/LibXSLT.pm line 48. BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/XML/LibXSLT.pm line 48. Compilation failed in require. BEGIN failed--compilation aborted.

cpan -i XML::LibXSLT confirms that XML::LibXSLT is up to date (1.99).

I tried updating the xslt libraries with brew install libxslt but it did not seem to make any difference.

I've tried running brew link libxslt --force , which now does not do anything ( Warning: Refusing to link macOS provided/shadowed software: libxslt ).

Running cpan -f -t XML::LibXSLT fails with the following error message:

looking for -lxslt... no
libxslt not found
Try setting LIBS and INC values on the command line

If I set the LIBS and INC values to the path suggested by brew export LIBS="-L/usr/local/opt/libxslt/lib" and export INC="-I/usr/local/opt/libxslt/include" , it still fails with this error.

Any suggestions on how to debug this? I'm not a Perl developer, just trying to run an existing app.

Perlbrew

Eventually, I succeeded with perlbrew instead of the default OS X system perl.

The following process worked, based on recommendations at https://perlbrew.pl :

curl -L https://install.perlbrew.pl | bash   
source ~/perl5/perlbrew/etc/bashrc
perlbrew install perl-5.16.0   
perlbrew switch perl-5.16.0
sudo cpan -i XML::LibXSLT

I consider it not as a proper solution but as a workaround - after all, there's no reason why the OS X preinstalled libxslt shouldn't just work with the preinstalled system perl - but it at least works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM