Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Architecture-specific module conflicts under perlbrew

by gnosti (Friar)
on May 16, 2013 at 02:13 UTC ( #1033755=perlquestion: print w/ replies, xml ) Need Help??
gnosti has asked for the wisdom of the Perl Monks concerning the following question:

Dedicated monks!

I'm in search of wisdom regarding perlbrew, specifically about controlling where perlbrew installs architecture-specific (i.e. compiled) modules.

I have installed perlbrew in standard fashion, used it to install a few versions of perl, and then installed some modules. But my architecture-specific files are going to a common tree, leading to this type of error:

$ which perl /home/jroth/perl5/perlbrew/perls/perl-5.16.3/bin/perl perl -M JSON::XS -e 1 Perl API version v5.14.0 of JSON::XS does not match v5.16.0 at /home/j +roth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/XSLoader.pm line 92. Compilation failed in require. BEGIN failed--compilation aborted.
Where did JSON::XS get installed?
find /home/jroth/perl5 -name XS.pm | grep JSON /home/jroth/perl5/lib/perl5/x86_64-linux/JSON/XS.pm
A shared directory! And where is my current perl looking for modules?
perl -E 'say join $/, @INC' /home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/jroth/perl5/lib/perl5/x86_64-linux /home/jroth/perl5/lib/perl5 /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_ +64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3 /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/x86_64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3
Does my environment have anything to do with this?
env | grep -i perl5lib PERL5LIB=/home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/ho +me/jroth/perl5/lib/perl5
Did I do that?
grep -i perl5lib ~/.bashrc ~/.bash_profile (n/t)
It appears I have two problems:

1. Under perlbrew, CPAN clients install architecture-specific files in a common tree, i.e.

/home/jroth/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/jroth/perl5/lib/perl5/x86_64-linux
even though these compiled files are most certainly incompatible across perl versions.

2. Under perlbrew, perl looks for architecture-specific files in a common tree, even though there are appropriate directories specific to each version of perl, i.e. one of

/home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_ +64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3 /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/x86_64-linux /home/jroth/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3
My questions are then, how to to set the preferences for a CPAN client under perlbrew to install to the latter set of directories (whether arguments, environment settings or patches?)

And similarly, to remove the former architecture-specific-shared directories from the PERL5LIB environment variable.

I'm confused that with perlbrew being around so long and having such a good reputation, no else seems to have this fundamental complaint and no bug has been filed against perlbrew on this issue.

Well there is a question at stackoverflow How can Install multiple Perl versions without them tripping over each other's XS modules? although the only answer is brian d foy's "don't use perlbrew, give each perl binary a version, i.e. perl-5.16.3 and let them find their own installed modules".

And there is Kent NL's post, although I didn't find it helpful, as cpanm clients continued installed to the shared tree, even after installing cpanm for each perl version.

Thanks for your interest and support!

UPDATE: For reasons unclear, my PERL5LIB environment variable is no longer set, and perlbrew is now behaving properly. I think it's possible that one of the terminals I was working had retained environment settings from local::lib, even after I had cleaned out those settings from .bashrc.

UPDATE 2: I've filed a bug against perlbrew, suggesting a warning on detecting any non-null PERL5LIB setting.

Comment on Architecture-specific module conflicts under perlbrew
Select or Download Code
Re: Architecture-specific module conflicts under perlbrew
by Anonymous Monk on May 16, 2013 at 05:12 UTC

    Does my environment have anything to do with this?

    You check that with perl -V command, because PERL5LIB isn't the only one

    Although even that won't dump your cpan|cpanp|cpanm configurations

    Under perlbrew, CPAN clients install architecture-specific files in a common tree, i.e.

    That doesn't seem like a perlbrew issue :) see INSTALL_BASE

    Although you could argue if perlbrew doesn't protect you from yourself ( from your INSTALL_BASE overrides ) what is perlbrew good for?

    An alternative to perl brew (not a bash script) is perlall - build, test and do with all perls

    Although, it's about as easy to manage multiple perl's yourself without either, for how I do it see sh Configure -Dprefix=~/p-5.8.1/, win32 configure steps/Fix_pl2bat

      Thanks. Once again, EU::MM shows it's still boss! If I can figure out what these environmental variables should be, I'll look into a patch to code or docs to help perlbrew be friendlier to a naive user.

        Thanks. Once again, EU::MM shows it's still boss! If I can figure out what these environmental variables should be, I'll look into a patch to code or docs to help perlbrew be friendlier to a naive user.

        Maybe you want to simplt=y check first that your %ENV/cpanconfigs aren't overriding any of those settings?

Re: Architecture-specific module conflicts under perlbrew
by karlgoethebier (Priest) on May 16, 2013 at 16:34 UTC

    I tried to reproduce this under Mac OS X Mountain Lion with 5.16.2 as well as with 5.16.3.

    I couldn't, everything looks good and works. I skip the details, please believe me for now ;-)

    Nice for me but that doesn't help, OK.

    On the other hand, as far as i understood your XS.pm is in your @INC.

    IMHO it can be everywhere, even in /nose/cuke as long as you declare this.

    At my system(s), it is in a site_perl directory, where it belongs.

    Just now i tried it under Mac OS X Lion:

    ./perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/darwin-2level/ +JSON/XS.pm

    And it works too.

    So why not opening an issue at github and ask for help?

    Update:

    I'm very interested in learning about this because i just started using perlbrew. I have it on two Macs for devel and on one SLES11 Debian box for testing my new Icinga/Nagios...

    I hope, that i didn't miss something and best regards, Karl

    P.S.: I assume, you did the setup as described in the sources you mentioned - and you use cpanm...

    «The Crux of the Biscuit is the Apostrophe»

      Yes, XS.pm got installed to the wrong directory in my @INC, an arch-specific but perl version-agnostic directory that should not even exist!

      You're right about opening an issue, although the previous reply suggests I might be able to get the correct behavior by setting the appropriate environment variables.

      Usually I come to PM first with my problems because they are more often due to my own ignorance than to a bug.

      Thanks and good luck with your various boxen.

        «Yes, XS.pm got installed to the wrong directory in my @INC...»

        But you don't get this well known message:

        Karls-Mac-mini:~ karl $ perl -MFOO Can't locate FOO.pm in @INC (@INC contains: #...bla, bla

        You get Perl API version v5.14.0...Compilation failed in require.

        That damned thing seems to be available - perhaps a bad place, but it is in your @INC, isn't it?

        Totally stupid "brute force" approach: Copy that thing to a place where you think it belongs (in @INC).

        Do you still get this compile time error? Or do i still miss something?

        Best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1033755]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-12-27 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls