0

Context

  1. I'm working in an offline environment, so no CPAN.
  2. My goal is to utilize OAuth.pm
  3. I manually installed Crypt::OpenSSL::RSA.

Problem

Can't locate Crypt/OpenSSL/RSA.pm in @INC (@INC contains: /usr/local/lib64/perl5 .)

@INC is truncated

I can see RSA.pm in /usr/local/lib64/perl5/Crypt/OpenSSL/... so I'm not sure how to troubleshoot this one.

This is after manually running make install

Sean
  • 15
  • 2
  • 6
  • What command/script did you run to get the error? Where did `make install` install the module? – Håkon Hægland Jul 16 '19 at 20:00
  • Can you only see it or can you also read it with the permissions of the same user who you are running the script with? – Steffen Ullrich Jul 16 '19 at 20:54
  • What steps did you use to manually install the module? It has XS components, so it would be easy to mess up. – AKHolland Jul 16 '19 at 20:57
  • @HåkonHægland it failed on OAuth.pm trying to use it – Sean Jul 16 '19 at 21:10
  • @Sean So you have a script that has a line `use OAuth`, and then the script fails? – Håkon Hægland Jul 16 '19 at 21:24
  • @AKHolland make, make test, make install – Sean Jul 16 '19 at 21:24
  • @Sean Did you run `perl Makefile.PL` before `make`? – Håkon Hægland Jul 16 '19 at 21:27
  • @HåkonHægland I did. I'll double check the test as I was working fast. – Sean Jul 16 '19 at 22:43
  • Crypt::OpenSSL::RSA does have test failures, and I'm looking at those. But, would that cause the issue I'm having? – Sean Jul 16 '19 at 22:59
  • What errors did you get? – Håkon Hægland Jul 16 '19 at 23:12
  • t/bignum.t .................. Can't load '/tmp/Crypt-OpenSSL-RSA-0.31/blib/arch/auto/Crypt/OpenSSL/RSA/RSA.so' for module Crypt::OpenSSL::RSA: /tmp/Crypt-OpenSSL-RSA-0.31/blib/arch/auto/Crypt/OpenSSL/RSA/RSA.so: failed to map segment from shared object: Operation not permitted at /usr/lib64/perl5/DynaLoader.pm line 190. at t/bignum.t line 4. Compilation failed in require at t/bignum.t line 4. BEGIN failed--compilation aborted at t/bignum.t line 4. – Sean Jul 16 '19 at 23:28
  • Each of the failed tests are failing on this same line `use Crypt::OpenSSL::RSA;` ... I don't understand why this would cause a test failure. Also, I have no idea why this appears to be similar to the issue in my original post. Even though `Crypt/OpenSSL/RSA.pm` exists in a valid directory within @INC... nothing can find it – Sean Jul 16 '19 at 23:49
  • The situation in the Question sounds like a permission problem. You say the file is there, but the user running the script probably can't see that it is. – ikegami Jul 17 '19 at 03:51

1 Answers1

0

I assume you are trying to run the script OAuth.pl (?).. Then the module OAuth.pm is in the same directory as the script and you need to add the current directory to @INC for the script to see the module:

perl -I. OAuth.pl   # I. --> add current directory to @INC

See Doesn't Perl include current directory in @INC by default? for more information.

Note: I tried to run the script but it still failed due to syntax errors. Here is a patch that seems to fix the errors.

Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
  • Thanks for the fixes! I hadn't started tackling the syntax errors yet. Regarding the OAuth.pm, it resides in a directory included in @INC and loads fine. It's when OAuth.pm tries to load Crypt-OpenSSL-RSA that I get the error. I loaded Crypt-OpenSSL-RSA manually. – Sean Jul 16 '19 at 22:42
  • @Sean I also noted that `OAuth.pl` has a shebang with `#!/usr/bin/perl`. This can be a problem if you have multiple `perl`s installed and the script is run as a command e.g. `./OAuth.pl` instead of `perl OAuth.pl` – Håkon Hægland Jul 16 '19 at 22:46
  • 1
    I'm not using OAuth.pl at all. I am loading OAuth.pm and using its methods in my own scripts in order to authenticate with Jira's REST API. The only challenge is that Crypt-OpenSSL-RSA is generating the "Can't locate..." error – Sean Jul 16 '19 at 23:05
  • @Sean I see, then this command `perl -MCrypt::OpenSSL::RSA -e1` gives the error? – Håkon Hægland Jul 16 '19 at 23:09
  • @Sean Ok if it does not give error then `perl` finds the module (i.e. it is found by searching `@INC`). Try to generate the mininmal script that produces the error – Håkon Hægland Jul 16 '19 at 23:13