Search code examples
perlcpan

Unable to load (and reinstall) Socket.pm after upgrade


I've just upgraded Slackware64 to 14.1 and I found Perl 5.18 in it. Socket.pm now complains that it was compiled for another Perl version, which was 5.16. Here is the error:

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

Unfortunately, I'm even unable to reinstall Socket.pm even with cpan.

$ 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

As far as I've understood, Socket.pm is a Perl core module. So, I thought it would have been upgraded together with Perl.

Here are directories currently in @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
.

I see some folders seems duplicate, but I don't actually know if they are supposed to be like that. However, there's no Socket.pm in the first two path (which I assume where added by cpan while running under my user, while I've a Socket.pm file for both /usr/local/lib64/perl5/ and /usr/lib64/perl5.


Solution

  • The solution is to clear the old modules, following 3rensho’s comment:

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

    It works!