/usr/bin/prove: Cannot find blib

189 views
Skip to first unread message

Kamal Ahmed

unread,
Nov 1, 2012, 12:15:06 PM11/1/12
to jenkins...@googlegroups.com
Hi,
When i run run_prove.sh after doing an ssh to host , the perl unit tests run fine
but when i do it via "Execute shell script on remote host using ssh" i get error:

11:41:35 + prove -b -v -r .
11:41:35 /usr/bin/prove: Cannot find blib
11:41:35 No blib directories found.
11:41:35 Can't locate Log/Log4perl.pm in @INC (@INC contains: 

I have tried with just execute shell script option as well, same result

Would appreciate any help / Hint/Resolution

Thanks,
-Kamal.


Kamal Ahmed

unread,
Nov 1, 2012, 12:18:26 PM11/1/12
to jenkins...@googlegroups.com

David Weintraub

unread,
Nov 1, 2012, 12:27:39 PM11/1/12
to jenkins...@googlegroups.com
Perl CPAN modules can be installed via user or via machine. Normally, if you can't get root access on the machine, you install it for that user. Maybe the Log::Log4perl module is installed as a user module. Thus, if you're running it as another user, you simply can't find the module.

Another possibility is that the module wasn't installed, and is located in a different directory than expected. The Perl @INC shows you the directories where modules are searched. The %INC hash shows the module loaded and the directory where found. 

Try a simple program:

use strict;
use warnings;
use feature qw(say);

use Log::Log4Perl

say "Perl \@INC: " . join "\n", @INC;
for my $module (sort keys %INC) {
    say qq(\$INC{$module} = "$INC{$module}");
}

Do this via SSH where you can execute run_prove.sh and it works. This will show you where this program is searching for the module and where it finds it. That will give you an idea why Jenkins can't find it.

If you do find that Log::Log4Perl is not where you expect it, use the "use lib" pragma to add that directory to your @INC search array.

Kamal Ahmed

unread,
Nov 1, 2012, 12:56:44 PM11/1/12
to jenkins...@googlegroups.com
Hi David,
Now i am getting error:

Can't locate feature.pm in @INC (@INC contains: /usr/coderyte/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/coderyte/lib/perl5/site_perl/5.8.8 /usr/coderyte/lib/perl5/5.8.8/x86_64-linux-thread-multi /usr/coderyte/lib/perl5/5.8.8 .) at ./test_log4p.pl line 4.
BEGIN failed--compilation aborted at ./test_log4p.pl line 4.


 more test_log4p.pl 

#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);

use Log::Log4Perl

say "Perl \@INC: " . join "\n", @INC;
for my $module (sort keys %INC) {
    say qq(\$INC{$module} = "$INC{$module}");
}


From: David Weintraub <qaz...@gmail.com>
To: jenkins...@googlegroups.com
Sent: Thursday, November 1, 2012 12:27 PM
Subject: Re: /usr/bin/prove: Cannot find blib

David Weintraub

unread,
Nov 1, 2012, 1:09:29 PM11/1/12
to jenkins...@googlegroups.com
I see you're on Perl 5.8.8 -- a release of Perl that's over six years old. The "use feature" pragma didn't come in until Perl 5.10 (current version is 5.16). All that "use feature" does is give you access to the "say" command. Say is like "print" except that it automatically includes a "\n".

Use this program. I removed "say" and used "print" instead:

#!/usr/bin/env perl
use strict;
use warnings;

use Log::Log4Perl

print  "Perl \@INC: " . join ("\n", @INC) . "\n"
;
for my $module (sort keys %INC) {
    print qq(\$INC{$module} = "$INC{$module}"\n);
}

By the way, note the @INC array which printed out as part of the error message:

* /usr/coderyte/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
* /usr/coderyte/lib/perl5/site_perl/5.8.8 
* /usr/coderyte/lib/perl5/5.8.8/x86_64-linux-thread-multi 
* /usr/coderyte/lib/perl5/5.8.8 

Compare that with the one you got as the Jenkins user. (You didn't include that in your original email!). I can see that Perl 5.8.8 isn't installed as a standard Perl program because it's under /usr/coderyte and not a standard directory. On most Unix type systems it's under /usr/share/perl or /usr/local/perl, or /var/perl or /opt/perl. I suspect that your Jenkins user is looking in different directories and maybe even using a completely different version of Perl.

What's the full error message you're getting with Jenkins. You only gave:

11:41:35 Can't locate Log/Log4perl.pm in @INC (@INC contains: 

You left off the interesting part.

On Nov 1, 2012, at 12:56 PM, Kamal Ahmed <kamal22...@yahoo.com> wrote:

Hi David,
Now i am getting error:

./test_log4p.pl 
Can't locate feature.pm in @INC (@INC contains: /usr/coderyte/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/coderyte/lib/perl5/site_perl/5.8.8 /usr/coderyte/lib/perl5/5.8.8/x86_64-linux-thread-multi /usr/coderyte/lib/perl5/5.8.8 .) at ./test_log4p.pl line 4.
BEGIN failed--compilation aborted at ./test_log4p.pl line 4.


 more test_log4p.pl 

#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);

use Log::Log4Perl

say "Perl \@INC: " . join "\n", @INC;
for my $module (sort keys %INC) {
    say qq(\$INC{$module} = "$INC{$module}");
}

Kamal Ahmed

unread,
Nov 1, 2012, 8:31:10 PM11/1/12
to jenkins...@googlegroups.com
David,

Unfortunately i would have to stick to Perl 5.8.8
Here is more of the error:

15:06:11
 + sh run_prove.sh
15:06:18 ./DBI_CrossFeed_Crosswalk_custom.................................Can't locate Log/Log4perl.pm in @INC (@INC contains: /extra/coderyte/nlp-builds/icd/icd-current/tools/perl_lib /extra/coderyte/www/iatqa/cgi-bin /extra/coderyte/www/iatqa/bin/engine/icd /extra/coderyte/www/iatqa/etc /extra/coderyte/www/iatqa/bin/engine/icd/engine /extra/coderyte/www/iatqa/bin/engine/icd/engine/perl_lib /extra/coderyte/www/iatqa/bin/engine/icd/engine/preproc /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl .) at /extra/coderyte/www/iatqa/cgi-bin/CodeRyte/Lynx.pm line 28.
15:06:18 BEGIN failed--compilation aborted at /extra/coderyte/www/iatqa/cgi-bin/CodeRyte/Lynx.pm line 28.
15:06:18 Compilation failed in require at /extra/coderyte/www/iatqa/cgi-bin/CodeRyte/Lynx/Lynx_Utilities.pm line 8.
15:06:18 BEGIN failed--compilation aborted at /extra/coderyte/www/iatqa/cgi-bin/CodeRyte/Lynx/Lynx_Utilities.pm line 8.
15:06:18 Compilation failed in require at ./DBI_CrossFeed_Crosswalk_custom.t line 10.
15:06:18 BEGIN failed--compilation aborted at ./DBI_CrossFeed_Crosswalk_custom.t line 10.
15:06:18 # Looks like your test died before it could output anything.
15:06:18 dubious
15:06:18 	Test returned status 2 (wstat 512, 0x200)
15:06:19 ./DBI_Services_NoteProfile.......................................Can't locate Date/Calc.pm in @INC (@INC contains: /extra/coderyte/www/iatqa/cgi-bin /extra/coderyte/www/iatqa/bin/engine/icd /extra/coderyte/www/iatqa/etc /extra/coderyte/www/iatqa/bin/engine/icd/engine /extra/coderyte/www/iatqa/bin/engine/icd/engine/perl_lib /extra/coderyte/www/iatqa/bin/engine/icd/engine/preproc /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl . /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl .) at /extra/coderyte/www/iatqa/cgi-bin/CodeRyte/Lynx/StagingDB.pm line 3.

and so on...


15:06:24 #     Error:  Can't locate Text/Unidecode.pm in @INC (@INC contains: /extra/coderyte/www/iatqa/cgi-bin /extra/coderyte/www/iatqa/bin/engine/icd /extra/coderyte/www/iatqa/etc /extra/coderyte/www/iatqa/bin/engine/icd/engine /extra/coderyte/www/iatqa/bin/engine/icd/engine/perl_lib /extra/coderyte/www/iatqa/bin/engine/icd/engine/preproc /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl . /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5
 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl .) at /extra/coderyte/www/iatqa/cgi-bin/CodeRyte/Lynx/Feed.pm line 5.
15:06:24 # BEGIN failed--compilation aborted at /extra/coderyte/www/iatqa/cgi-bin/CodeRyte/Lynx/Feed.pm line 5.
15:06:24 # Compilation failed in require at (eval 1) line 2.
15:06:24 Can't locate object method "new" via package "CodeRyte::Lynx::Feed" at ./Feed-Binary_Conversion.t line 13.
15:06:24 1..1
15:06:24 # Looks like you failed 1 tests of 1.
15:06:24 # Looks like your test died just after 1.
15:06:24 dubious
15:06:24 	Test returned status 255 (wstat 65280, 0xff00)
15:06:24 DIED. FAILED test 1
15:06:24 	Failed 1/1 tests, 0.00% okay
15:06:24 ./DBI_Assembler_Primary_Defined_Counts...........................Can't locate Log/Log4perl.pm in @INC (@INC contains: 


Strange thing is when @ work, i am connected to this remote slave , and when i come home and connect via VPN, i am still connected even though the IP changed, and the connection was severed for the time i was driving.



From: David Weintraub <qaz...@gmail.com>
To: jenkins...@googlegroups.com
Sent: Thursday, November 1, 2012 1:09 PM

David Weintraub

unread,
Nov 1, 2012, 10:01:04 PM11/1/12
to jenkins...@googlegroups.com
Look at this @INC path:


  • /extra/coderyte/nlp-builds/icd/icd-current/tools/perl_lib 
  • /extra/coderyte/www/iatqa/cgi-bin 
  • /extra/coderyte/www/iatqa/bin/engine/icd 
  • /extra/coderyte/www/iatqa/etc 
  • /extra/coderyte/www/iatqa/bin/engine/icd/engine 
  • /extra/coderyte/www/iatqa/bin/engine/icd/engine/perl_lib 
  • /extra/coderyte/www/iatqa/bin/engine/icd/engine/preproc 
  • /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi 
  • /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi 
  • /usr/lib/perl5/site_perl/5.8.5 
  • /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi 
  • /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi 
  • /usr/lib/perl5/vendor_perl
Now look at the one @INC you sent me with the program error:

  • /usr/coderyte/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
  • /usr/coderyte/lib/perl5/site_perl/5.8.8 
  • /usr/coderyte/lib/perl5/5.8.8/x86_64-linux-thread-multi 
  • /usr/coderyte/lib/perl5/5.8.8 

You see a difference?

In fact, I believe you're looking at two different Perl libraries being executed. Note the "perl5" portions of the paths! In the second one, they're all /usr/coderyte/lib. In the one you just sent me, they're "/usr/lib/perl5". 

The "site_perl" paths are for CPAN modules you install. They're usually in the @INC first, so you can override the versions of the same modules that came wiith the installation.

So, your problem is that you are executing two different Perl programs. One you are using when you use Jenkins which is the Perl version that probably came with the system. The other is what you execute when you use the SSH user.

Log in as your SSH user, the one which allows the program to work. Then, type in "which perl" at the command line. This is the Perl you must execute as the Jenkins user. Either fix the first line (the shebang (#!)) to point to the SSH user's Perl, or prepend your Perl script with that Perl program (include the full path).


Kamal Ahmed

unread,
Nov 2, 2012, 8:54:27 AM11/2/12
to jenkins...@googlegroups.com
right on the dot!

Here is what i believe is happening:
Jenkins THINKS the perl means /usr/bin/perl , but the actual perl is /usr/coderyte/bin/perl

which prove
/usr/coderyte/bin/prove
kahmed@athena ~/workspace/ONATHENA $ which perl
/usr/coderyte/bin/perl

am i right in this assumption ?

Now, how can i trick Jenkins to believe that perl actually means /usr/coderyte/bin/perl

Since i cannot change the #! in code.

Thanks,
-Kamal.

From: David Weintraub <qaz...@gmail.com>
To: jenkins...@googlegroups.com
Sent: Thursday, November 1, 2012 10:01 PM

Andrew Melo

unread,
Nov 2, 2012, 8:55:58 AM11/2/12
to jenkins...@googlegroups.com
On Fri, Nov 2, 2012 at 1:54 PM, Kamal Ahmed <kamal22...@yahoo.com> wrote:
> right on the dot!
>
> Here is what i believe is happening:
> Jenkins THINKS the perl means /usr/bin/perl , but the actual perl is
> /usr/coderyte/bin/perl
>
> which prove
> /usr/coderyte/bin/prove
> kahmed@athena ~/workspace/ONATHENA $ which perl
> /usr/coderyte/bin/perl
>
> am i right in this assumption ?
>
> Now, how can i trick Jenkins to believe that perl actually means
> /usr/coderyte/bin/perl
>
> Since i cannot change the #! in code.

export PATH=/usr/codertyte/bin:$PATH

will make it so the shell will search your custom directory before
looking in the system-wide directories.

HTH
Andrew
--
--
Andrew Melo

David Weintraub

unread,
Nov 2, 2012, 10:20:14 AM11/2/12
to jenkins...@googlegroups.com
On Nov 2, 2012, at 8:54 AM, Kamal Ahmed <kamal22...@yahoo.com> wrote:

right on the dot!

Here is what i believe is happening:
Jenkins THINKS the perl means /usr/bin/perl , but the actual perl is /usr/coderyte/bin/perl

which prove
/usr/coderyte/bin/prove
kahmed@athena ~/workspace/ONATHENA $ which perl
/usr/coderyte/bin/perl

am i right in this assumption ?

Yes.


Now, how can i trick Jenkins to believe that perl actually means /usr/coderyte/bin/perl

Since i cannot change the #! in code.

Instead of executing just "prove", execute "/usr/coderyte/bin/perl prove". This will specify the version of Perl you want to use.

Kamal Ahmed

unread,
Nov 2, 2012, 10:27:37 AM11/2/12
to jenkins...@googlegroups.com
its working !
used:
export PATH=/usr/codertyte/bin:$PATH
prove WAS/is  the coderyte prove

Thanks David and Andrew


From: David Weintraub <qaz...@gmail.com>
To: jenkins...@googlegroups.com
Sent: Friday, November 2, 2012 10:20 AM
Reply all
Reply to author
Forward
0 new messages