Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Perl version issue?

by T-Fen (Acolyte)
on Oct 26, 2014 at 02:06 UTC ( [id://1105009]=perlquestion: print w/replies, xml ) Need Help??

T-Fen has asked for the wisdom of the Perl Monks concerning the following question:

Hello perl monks-

I'm on a Mac and recently upgraded from Mavericks to Yosemite which might be the cause of my current issue.

I am using mutt with t-prot and getting the following error when attempting to view a message in mutt (which invokes t-prot)

'Can't locate Locale/gettext.pm in @INC (you may need to install the Locale::gettext module) (@INC contains: /Library/Perl/5.12 /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/bin/t-prot line 1147.

When i do a search for getttext, I see the following:

/Library/Perl/5.16/darwin-thread-multi-2level/Locale/gettext.pm /Library/Perl/5.16/darwin-thread-multi-2level/auto/Locale/gettext /Library/Perl/5.16/darwin-thread-multi-2level/auto/Locale/gettext/.pac +klist /Library/Perl/5.16/darwin-thread-multi-2level/auto/Locale/gettext/gett +ext.bs /Library/Perl/5.16/darwin-thread-multi-2level/auto/Locale/gettext/gett +ext.bundle /Previous System/Library/Perl/5.16/darwin-thread-multi-2level/auto/Loc +ale/gettext /Previous System/usr/local/Cellar/gettext/0.19.3/share/doc/gettext/exa +mples/hello-perl /Previous System/usr/local/Cellar/gettext/0.19.3/share/doc/gettext/exa +mples/hello-perl/m4 /Previous System/usr/local/Cellar/gettext/0.19.3/share/doc/gettext/exa +mples/hello-perl/po /usr/local/Cellar/gettext/0.19.3/share/doc/gettext/examples/hello-perl /usr/local/Cellar/gettext/0.19.3/share/doc/gettext/examples/hello-perl +/INSTALL /usr/local/Cellar/gettext/0.19.3/share/doc/gettext/examples/hello-perl +/Makefile.am /usr/local/Cellar/gettext/0.19.3/share/doc/gettext/examples/hello-perl +/autoclean.sh

So seeing that @INC doesn't appear to look in /Library/Perl/5.16/ I then added the path using:

$ PERL5LIB=/Library/Perl/5.16/darwin-thread-multi-2level/; export PERL5LIB

Doing that, I now get this error when trying to view a message with mutt/t-prot:

'Perl API version v5.16.0 of v5.16.0 does not match v5.18.0 at /System +/Library/Perl/5.18/darwin-thread-multi-2level/DynaLoader.pm line 217. + + + Compilation failed in req +uire at /usr/local/bin/t-prot line 1147.

/Library/Perl/ contains a /5.16 and a /5.18 directory but looks like anything related to gettext is only in /5.16. Looking for guidance on how to fix this so that the needed files are found.

Thanks!

Replies are listed 'Best First'.
Re: Perl version issue?
by tobyink (Canon) on Oct 26, 2014 at 03:11 UTC

    Locale::gettext is not a pure Perl module (parts of it are written in C) so is not portable between different versions of Perl. Perl 5.18 (which you are using) can't load a copy of the module that was compiled for Perl 5.16. In general, it's not usually a good idea to share a library directory between multiple versions of Perl.

    Take the 5.16-specific path out of PERL5LIB. (And you probably want to look at why /Library/Perl/5.12 is there too!) Then install this module afresh into one of Perl 5.18's library directories.

Re: Perl version issue?
by perlron (Pilgrim) on Oct 26, 2014 at 09:14 UTC
    Rule #1 is not tweak anything in the system perl core libs as they are used by your OS. before your upgrade u could have backed up /usr/local and .vimrc and any pertinent files/libs to an external drive..
    Someone recommended perlbrew with cpanm to me the other day and there was no looking back for me.
    a simple command like perlbrew switch perl_version ensured i am looking at the currect library paths for the current version of perl i want to use.
    cpanm to install your libraries in tandem.
    Do not wait to strike when the iron is hot! Make it hot by striking - WB Yeats

      Thanks. I have /usr/local and .vimrc backed up to an external drive via Time Machine (and Crashplan).

      How can I go about fixing my issue with t-prot finding the needed getttext piece(s) it's looking for? Is it resorting some of the files I previously backed up? Is it as simple as installing perlbrew and running a command like 'switch perl_version'?

      And to the other responder's question, not sure why I have multiple versions of Perl installed. How can I go about 'fixing' my Perl install?

      Thanks

        I can say that the fix u tried of updating the path to 5.16 in perl5lib might not work because i believe the perl path is hard coded/concealed in the osx code at many places, especialy in the XCode preferences and such.
        the gettext software ( i havent used it much..maybe not at all) i assume u installed it by hand on 5.16. thats the start of the problem :D i think . that was system perl. u should have download a more recent version of perl then and updated the PATH variable to use your new version of perl with gettext.
        to fix the issue with gettext, u would , in my opinion , have to remove it or find a way to make sure gettext points to the new version of perl installed by yosemite

        yes if u install perlbrew and cpanm u will see how hassle free it will be going forward.
        Do not wait to strike when the iron is hot! Make it hot by striking - WB Yeats
Re: Perl version issue?
by farang (Chaplain) on Oct 27, 2014 at 01:11 UTC

    It looks to me as though your problem is a result of two things. First, you previously altered your system perl in order to install Locale:gettext. Second, you upgraded your operating system instead of doing a clean install. Here are three different actions, any one of which may get you working again.

    1. Enter the command which -a perl and see if your v5.16 Perl shows up. If it does, hard code the path into your startup script, possibly at line 1147 of the file listed in the error. This solution is hackish, may come back to bite you in the future, but if it works might be the fastest way to get those applications going.
    2. Use administrator access (e.g. sudo) to install Locale::gettext into your new system perl, v5.18. This also somewhat hackish and not recommended because it could cause side effects with the system or stop working due to upgrades, but probably would work fine.
    3. Install your own perl as a non-administrator, install Locale::gettext to that version, and make it the default for your user-id, leaving the system perl alone. This is the best fix of the three.

    Perlbrew is a great way to accomplish the latter fix. Follow these steps, and don't type "sudo" in any of them.

    • Install perlbrew, initialize it with perlbrew init, and add the "source" line as indicated to the file ~/.bash_profile, creating that file if needed.
    • Enter perlbrew available to get a list of perls. Install one of them with perlbrew install <one-of-them>. The current stable version is perl-5.20.1 which would be a good choice.
    • Now you can enter perlbrew switch <the-same-one> to make it the first in your path and the default. Type perl -v in a newly opened terminal to verify.
    • Enter perlbrew install-cpanm and then cpanm Locale::gettext and with luck the module will install without error and you'll be done.

      Thanks. I went to check my ~/.bash_profile and saw that I already had a line there for perlbrew:

      source ~/perl5/perlbrew/etc/bashrc

      And I have the perlbrew directory containing perl v5 (which looks to be perl version 5.15):

      /Users/trey/perl5/perlbrew

      'perl -v' shows version 5.18. So would the 'recommended' fix here be to run 'perl install perl-5.20.1' followed by 'perl switch 5.20.1' to install and then use the latest version?

      It would appear that my ~/.bash_profle would remain unchanged

        'perl -v' shows version 5.18. So would the 'recommended' fix here be to run 'perl install perl-5.20.1' followed by 'perl switch 5.20.1' to install and then use the latest version?
        Yes, except that's perlbrew install ... and perlbrew switch .... You have to make sure you still have perlbrew after the upgrade to Yosemite, otherwise re-install it. The command perlbrew list should show you which perls are installed under perlbrew, and just perlbrew by itself shows a help screen when it's installed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1105009]
Approved by farang
Front-paged by boftx
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found