升级后无法加载(并重新安装)Socket.pm

时间:2013-11-26 09:50:14

标签: perl cpan

我刚刚将Slackware64升级到14.1,我发现了Perl 5.18。 Socket.pm现在抱怨它是为另一个Perl版本编译的,它是5.16。这是错误:

Perl API version v5.16.0 of Socket does not match v5.18.0 at /usr/share/perl5/XSLoader.pm line 92.

不幸的是,即使使用cpan,我甚至无法重新安装Socket.pm.

$ cpan Socket
Reading '/home/francesco-salix/.cpan/Metadata'
  Database was generated on Tue, 26 Nov 2013 09:08:12 GMT
Running install for module 'Socket'
Running make for P/PE/PEVANS/Socket-2.013.tar.gz
Checksum for /home/francesco-salix/.cpan/sources/authors/id/P/PE/PEVANS/Socket-2.013.tar.gz ok

  CPAN.pm: Building P/PE/PEVANS/Socket-2.013.tar.gz

Attempt to reload Socket.pm aborted.
Compilation failed in require at /usr/share/perl5/IPC/Cmd.pm line 46.
BEGIN failed--compilation aborted at /usr/share/perl5/IPC/Cmd.pm line 46.
Compilation failed in require at /usr/share/perl5/ExtUtils/CBuilder/Base.pm line 11.
BEGIN failed--compilation aborted at /usr/share/perl5/ExtUtils/CBuilder/Base.pm line 11.
Compilation failed in require at /usr/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 4.
Compilation failed in require at (eval 6) line 2.
BEGIN failed--compilation aborted at (eval 6) line 2.
Compilation failed in require at Makefile.PL line 19.
Warning: No success on command[/usr/bin/perl5.18.1 Makefile.PL]
'YAML' not installed, will not store persistent state
  PEVANS/Socket-2.013.tar.gz
  /usr/bin/perl5.18.1 Makefile.PL -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites

据我所知,Socket.pm是一个Perl核心模块。所以,我认为它会与Perl一起升级。

以下是目前@INC中的目录:

$ perl -E'say for @INC'
/home/francesco-salix/perl5/lib/perl5/x86_64-linux-thread-multi
/home/francesco-salix/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
.

我看到一些文件夹似乎重复,但我实际上并不知道它们应该是那样的。但是,前两个路径中没有Socket.pm(我假设在我的用户下运行时由cpan添加的路径,而我的Socket.pm文件是/usr/local/lib64/perl5/ /usr/lib64/perl5和{{1}}。

2 个答案:

答案 0 :(得分:2)

Socket.pm确实是一个核心模块。并且 CPAN.pm模块 ExtUtils :: MakeMaker使用它(通过IPC :: Cmd),所以如果Socket.pm被破坏, CPAN.pm Makefile.PL将是也破了。

鉴于它是一个核心模块,并且已经安装了Perl,这告诉我Perl正在尝试从其他一些较旧的路径加载Socket.pm。以下内容将告诉您Perl尝试从以下位置加载模块的位置:

perl -E'say for @INC'

那里有什么可疑之处。它可能会找到为Perl 5.16编译的旧模块的任何地方吗?

答案 1 :(得分:1)

解决方案是在3rensho’s comment之后清除旧模块:

sudo rm -rf /usr/local/lib64/perl5/*
sudo rm -rf /usr/local/share/perl5/*

有效!