Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unshifting incorrect/old lib dirs onto @INC #88

Open
castaway opened this issue Jun 18, 2021 · 2 comments
Open

Unshifting incorrect/old lib dirs onto @INC #88

castaway opened this issue Jun 18, 2021 · 2 comments

Comments

@castaway
Copy link

I have been trying to install Convos, one of the deps is File::Remove, which uses Module::Build. I'm running this using the convos installer, which runs cpanm for each of the deps, which does its usual magic. Something was failing when installing File::Remove, as something was looking for an .so file in the wrong lib dir (in 5.30.3 dirs, not in 5.32 dirs)

NB: I had the same issue for some of the other dependencies, if I install them manually using cpanm on the command line, then they install .. via the script, they didn't. This one I decided to try and poke into why. (Until after various runs with debugging in Module::Build::Base, it did then magically install... )

Caveat - yes my perl -V has stuff in its @inc from previous versions, this is generally fine as perl reads them in order, and the old stuff is at the bottom. Why, I dunno, this is a gentoo system Perl.

perl -V:

  Built under linux
  Compiled at May 27 2021 16:13:00
  @INC:
    /etc/perl
    /usr/local/lib64/perl5/5.32/x86_64-linux-thread-multi
    /usr/local/lib64/perl5/5.32
    /usr/lib64/perl5/vendor_perl/5.32/x86_64-linux-thread-multi
    /usr/lib64/perl5/vendor_perl/5.32
    /usr/lib64/perl5/5.32/x86_64-linux-thread-multi
    /usr/lib64/perl5/5.32
    /usr/lib64/perl5/5.30.3
    /usr/lib64/perl5/vendor_perl/5.30.3
    /usr/local/lib64/perl5/5.30.3
    /usr/lib64/perl5/vendor_perl/5.30.1
    /usr/local/lib64/perl5/5.30.1
    /usr/lib64/perl5/vendor_perl/5.28.2

Error (with strace):

stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/x86_64-linux-thread-multi/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/x86_64-linux-thread-multi/Encode.pm", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/Encode.pm", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/lib/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/mnt/allthespace/usrsrc/extern/convos/lib/Encode.pm", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/Encode.pmc", 0x7ffdfcc23620) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/Encode.pm", {st_mode=S_IFREG|0444, st_size=32083, ...}) = 0
openat(AT_FDCWD, "/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/Encode.pm", O_RDONLY|O_CLOEXEC) = 4
ioctl(4, TCGETS, 0x7ffdfcc233d0)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR)                   = 0
read(4, "#\n# $Id: Encode.pm,v 3.06 2020/0"..., 8192) = 8192
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/auto/Encode/Encode.so", {st_mode=S_IFREG|0555, st_size=54544, ...}) = 0
stat("/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/auto/Encode/Encode.bs", 0x55ef5ed004b8) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi/auto/Encode/Encode.so", O_RDONLY|O_CLOEXEC) = 5

Encode.c: loadable library and perl binaries are mismatched (got handshake key 0xcd00080, needed 0xed00080)

Assumption: this is because Module::Build unshifts some dirs onto @inc, one of them is the OLD dir for the Encode.pm/.so files:

  unshift @INC,
    (
     '/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5/x86_64-linux-thread-multi',
     '/mnt/allthespace/usrsrc/extern/convos/local/lib/perl5',
     '/mnt/allthespace/usrsrc/extern/convos/lib',
     '/usr/local/lib64/perl5/5.30.3/x86_64-linux-thread-multi',
     '/usr/local/lib64/perl5/5.30.1/x86_64-linux-thread-multi'
    );

From I assume here:

my @myINC = $self->_added_to_INC;
for (@myINC, values %q) {
$_ = File::Spec->canonpath( $_ ) unless $self->is_vmsish;
s/([\\\'])/\\$1/g;
}

Reading it (and dumping the @inc and the inc from _default_inc) (why would they be different!?) is as far as I got before the universe decided it would play after all...

There definitely is an Encode in the 5.32 dirs, it just doesn't get found first when using Module::Build (sometimes!) Makefile.PL based dists seem fine..

@Grinnz
Copy link
Contributor

Grinnz commented Jun 18, 2021

It seems to be adding the archlib dirs of the @INC dirs you have set. I think the problem here is that all of those old version dirs are in @INC for an unrelated perl. Do you have PERL5LIB set?

@castaway
Copy link
Author

castaway commented Jun 18, 2021

It seems to be adding the archlib dirs of the @INC dirs you have set. I think the problem here is that all of those old version dirs are in @INC for an unrelated perl. Do you have PERL5LIB set?

I also wondered - but I dumped $perl in the _default_inc sub, and its /usr/bin/perl / No PERL5LIB set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants