Perl @INC path wrong

667 views
Skip to first unread message

L V Lammert

unread,
Feb 3, 2015, 4:37:22 PM2/3/15
to stl...@googlegroups.com
Started working on a new [to me] VPS last week, .. encountering a problem with a shell login (new user):

Can't locate local/lib.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.8/x86_64-linux /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .).
BEGIN failed--compilation aborted.

It APPEARS that  the path is just wrong:

$locate local/lib.pm
/usr/lib/perl5/site_perl/5.8.8/local/lib.pm

How does one fix the path? So far, my quack-fu only turns up notes about *installing* local/lib.pm, ...

    TIA!

    Lee

Matt Follett

unread,
Feb 3, 2015, 5:01:10 PM2/3/15
to stl...@googlegroups.com
You can set PERL5LIB, use the -I option or modify @INC. Explanation here:
http://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations

~Matt

--
You received this message because you are subscribed to the Google Groups "St. Louis Perl Mongers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stl-pm+un...@googlegroups.com.
To post to this group, send email to stl...@googlegroups.com.
Visit this group at http://groups.google.com/group/stl-pm.
For more options, visit https://groups.google.com/d/optout.

L. V. Lammert

unread,
Feb 3, 2015, 6:11:02 PM2/3/15
to stl...@googlegroups.com
On Tue, 3 Feb 2015, Matt Follett wrote:

> You can set PERL5LIB, use the -I option or modify @INC. Explanation here:
> http://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations
>
> ~Matt
>
Excellent! Unfortunately, the writeup is about adding one's own
module, .. What would correct PERL5LIB to remove the "local"?

Where the compiled INC is /usr/local:

/usr/local/lib/perl5/5.8.8/x86_64-linux

and the system needs /usr/lib:

/usr/lib/perl5/site_perl/5.8.8/local/lib.pm

Thanks!!

Lee

Steven Lembark

unread,
Feb 4, 2015, 11:28:38 AM2/4/15
to stl...@googlegroups.com, lem...@wrkhors.com
On Tue, 3 Feb 2015 17:10:58 -0600 (CST)
"L. V. Lammert" <lvla...@gmail.com> wrote:

> Excellent! Unfortunately, the writeup is about adding one's own
> module, .. What would correct PERL5LIB to remove the "local"?
>
> Where the compiled INC is /usr/local:
>
> /usr/local/lib/perl5/5.8.8/x86_64-linux
>
> and the system needs /usr/lib:
>
> /usr/lib/perl5/site_perl/5.8.8/local/lib.pm

Q: Where does the perl binary you are running live?

The lib's your perl is configured to use at compile time should be
siblings of the bin directory your perl is run from. The system
perl will usually be in /usr/bin/perl, whatever you've installed
for your own use will live in /usr/local (BSD) or /opt (SYSV, linux).

At that point @INC will usually be based on something like
/usr/local/lib/perl or /usr/local/perl5/5.20.1/lib or /opt/lib
or /opt/perl5/lib.

At that point if you are trying to use modules that exist under
/usr/lib/perl5 from a binary run from /usr/local/bin then it
means you need to run you favorite CPAN interface to install them
where the perl binary is configured to find them.

Note: In general mixing your lib's with the system's is a bad idea.
Partly becuase the O/S lib's are infrequently updated and can have
security or operability problems, also because you cannot update
them without (a) su access and (b) possibly frying some piece of
the O/S code that is bug-compatible an ancient module.


--
Steven Lembark 3646 Flora Pl
Workhorse Computing St Louis, MO 63110
lem...@wrkhors.com +1 888 359 3508

L. V. Lammert

unread,
Feb 4, 2015, 1:47:06 PM2/4/15
to stl...@googlegroups.com, lem...@wrkhors.com
On Wed, 4 Feb 2015, Steven Lembark wrote:

> > Where the compiled INC is /usr/local:
> >
> > /usr/local/lib/perl5/5.8.8/x86_64-linux
> >
> > and the system needs /usr/lib:
> >
> > /usr/lib/perl5/site_perl/5.8.8/local/lib.pm
>
> Q: Where does the perl binary you are running live?
>
Hi Steve!

I am doing nothing myself with Perl, .. the error occurs at a bash login
[of a new user].

It *seems* like the version installed is not configured correctly, .. as
@INC refers to base paths /usrlocal/lib/perl5, whereas the system actually
is using /usr/lib/perl5. Either there is a mis-match between the Perl
version and the system installation, *OR* something is borked in /etc/skel
[which would have been used to create this user].

Would that not be a machine configuration problem? This is a cPanel VPS
[not built here], .. and I have never seen an @INC mismatch at the login
level.

The only reason to pursue the problem is to convince the hosting company
that they need to give us a machine with a valid configuration. If there
is an issue with the configuration of the installed Perl, what other
problems may exist?

Thanks!

Lee

Steven Lembark

unread,
Feb 13, 2015, 9:00:10 PM2/13/15
to stl...@googlegroups.com, lem...@wrkhors.com

> I am doing nothing myself with Perl, .. the error occurs at a bash
> login [of a new user].
>
> It *seems* like the version installed is not configured correctly, ..
> as @INC refers to base paths /usrlocal/lib/perl5, whereas the system
> actually is using /usr/lib/perl5. Either there is a mis-match between
> the Perl version and the system installation, *OR* something is
> borked in /etc/skel [which would have been used to create this user].
>
> Would that not be a machine configuration problem? This is a cPanel
> VPS [not built here], .. and I have never seen an @INC mismatch at
> the login level.
>
> The only reason to pursue the problem is to convince the hosting
> company that they need to give us a machine with a valid
> configuration. If there is an issue with the configuration of the
> installed Perl, what other problems may exist?

Looks like your problem is that someone tried to install perl into
/usr/local/bin/perl and their shell doesn't have /usr/local/bin/ on
the default path.

Q: Is there an executable /usr/local/bin/perl on the system?

If so then (a) this is linux not BSB, put it in /opt/bin/where
it belongs and (b) either way, put the correct bin directroy at
the head of your path.

If /usr/local/bin is *already* on your path then flog the pinhead
who hardwired "#!/usr/bin/perl" instead of "#!/bin/env perl" and
then convert whatever perlish code is using /usr/bin/perl to use
"/bin/env perl".


Note that the *system* will always use /usr/bin/perl, and you normally
want to use /opt/bin/perl (/usr/local/bin/perl on BSD) since you want
a version of the module lib's that you can keep up to date. If you
really need to bang on the provider I'll be more than happy to help
deal with it Monday morning (reasonable rates and I'm available early
enough to have the guy working by lunchtime :-).

Steven Lembark

unread,
Mar 7, 2015, 9:53:07 AM3/7/15
to stl...@googlegroups.com, lem...@wrkhors.com

You ever get this fixed?
If so, what was the problem?

L. V. Lammert

unread,
Mar 7, 2015, 11:49:32 AM3/7/15
to stl...@googlegroups.com, lem...@wrkhors.com
On Sat, 7 Mar 2015, Steven Lembark wrote:

> You ever get this fixed?
> If so, what was the problem?
>
Turns out the system-wide bashrc had been munged by a cPanel update (or
elsewise damaged by that horrible system), .. once I managed to get
through to someone at the hosting company that could spell Perl it was a
simple fix.

Lee
Reply all
Reply to author
Forward
0 new messages