0

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.

Zagorax
  • 11,440
  • 8
  • 44
  • 56

2 Answers2

2

Socket.pm is indeed a core module. And the CPAN.pm moduleExtUtils::MakeMaker uses it (via IPC::Cmd), so if Socket.pm is broken, CPAN.pmMakefile.PL will be broken too.

Given that it is a core module, and would have been installed with Perl, this suggests to me that Perl is trying to load Socket.pm from some other, older path. The following will tell you where Perl is trying to load modules from:

perl -E'say for @INC'

Is there anything suspicious in there. Any place it might find older modules compiled for Perl 5.16?

tobyink
  • 13,478
  • 1
  • 23
  • 35
  • @tobyinc, you may be right. See my edit. May you please post your current `@INC`? – Zagorax Nov 26 '13 at 10:48
  • According to `pkgtools`, the `perl` package refers the file in `/usr/lib64/perl5`, so I assume the `/usr/local/lib64/perl5` refers older files, that were not removed during upgrade. How do I fix the include path? – Zagorax Nov 26 '13 at 10:51
  • I'm not on Slackware, so my @INC is unlikely to be helpful to you. I concur with ikegami that the paths in your home directory are most likely to be the problematic ones. I'd start with scrubbing those. – tobyink Nov 26 '13 at 17:02
  • Additional paths can be added to `@INC` using the `PERL5LIB` environment variable. `@INC` can also be fiddled with at run-time (it's just a plain old array of strings, albeit magically global, so can be pushed/popped/etc). – tobyink Nov 26 '13 at 17:05
  • Of course I can modify the `@INC` array at run time, but doing it for every script is a bit annoying. Is there any way to change the default `@INC`? – Zagorax Nov 27 '13 at 08:27
  • Oh, I see it's set at compile time. – Zagorax Nov 27 '13 at 08:32
1

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!

shenwei356
  • 128
  • 8