7

Hello StackOverflow Community,

I am trying to install a perl module, IO::All. But every time I use CPAN to install many perl modules (including if I run from within cpan "install Build::CPAN") it fails with

Can't locate strict.pm in @INC (@INC contains: /dev/null/lib/perl5.8-dist/Linux-2.6c2.5-x86_64-64int /dev/null/lib/perl5.8-dist /dev/null/lib/perl5.8-dist/Linux-2.6c2.5-x86_64-64int /dev/null/lib/perl5.8-dist /dev/null/lib/perl5.8-dist .) at Build.PL line 2.

This has been baffling me for hours. I've googled around and can't seem to find a solution. Running something like

perl -e 'use strict; print "ok"'

Outputs just fine. And the original file I was trying to run, which asks for IO::All uses strict as well. How is strict even missing? Isn't strict part of perl by default? And where is /dev/null? Isn't that a special location where you can pass in stderr/stdout if you don't care about that? I've been pulling my hair out about this for a while. I must be missing something obvious.

This is running on a Rhel5 Virtual Machine Linux-2.6-x86_64 variant.

Your help is much appreciated. Let me know if I need to provide further information.

Thank you, -Asaf

Asaf
  • 815
  • 1
  • 9
  • 25
  • 1
    Could you please provide the output of `echo o conf | perl -MCPAN -e shell` – ikegami Apr 06 '14 at 01:48
  • @ikegami I've posted the output as part of the question. I hope it helps. – Asaf Apr 06 '14 at 02:01
  • 1
    What are `/apollo/env/envImprovement/bin/make` and `/apollo/env/envImprovement/var/bin/zsh`? I'd try doing 1) `o conf make /usr/bin/make` 2) `o conf shell /bin/sh` 3) `o conf commit` to see if that makes a difference. – ikegami Apr 06 '14 at 02:36
  • 1
    what does `perl -V:install.*lib` show? what does `perl -wle'print for @INC'` show? – ysth Apr 06 '14 at 05:57
  • @ikegami Those are tools that have to do with where I work and without providing those details I will just say that I don't think those are the problem. Both that make and zsh shell are used elsewhere constantly. Still, I will take your advice and give that a try. That command doesn't seem to work, I'll just rerun the full conf for cpan by moving the configuration file. – Asaf Apr 06 '14 at 15:58
  • @ysth The second output I added to my question. The first one returned "zsh: no matches found: -V:install.*lib". Could the command be missing a space or character somewhere? Thanks for your help. – Asaf Apr 06 '14 at 16:16
  • 1
    then do `perl '-V:install.*lib'` (though the `@INC` info shows that's not likely useful). what is all this apollo envImprovement stuff, do you know? what does `perl -Mstrict -wle'print $INC{"strict.pm"}'` show? – ysth Apr 06 '14 at 16:51
  • 1
    `$INC{"strict.pm"}` will surely give something under /apollo/. I'm interseted in the output of the `perl '-V:install.*lib'` too – ikegami Apr 06 '14 at 17:28
  • 1
    What?! the install lib isn't even in @INC? – ikegami Apr 06 '14 at 17:32
  • @ysth and ikegami I've added the output of both above. To give some clarifying info about the apollo envImprovement stuff, they are all tools provided at the place I work. They are installed on developer desktops and used throughout the company. It provides a way to centralize the tools and keep them up to date. – Asaf Apr 06 '14 at 17:32
  • @ikegami I'm getting the feeling more and more that the perl installed may have some incorrect configurations. Maybe these tools that are default installed have problems and I should try and install a different version of perl? – Asaf Apr 06 '14 at 17:35
  • 2
    What?! the install lib isn't even in `@INC`? Yes, there's some weirdness in how this perl was built/installed. At this point, I'm wondering how the `/apollo/` are added to `@INC`. Those paths should be hardcoded into `perl`, but they seem to be added by some other means that's getting overridden. I wonder what you have in the `%ENV` section of `perl -V` (uppercase "V"). – ikegami Apr 06 '14 at 17:38
  • 1
    It's not the version of Perl that's the problem (thought 5.8 is rather ancient), but how `perl` was built/installed. – ikegami Apr 06 '14 at 17:40
  • @ikegami I added the %ENV section in my answer above, though I don't know if it is very revealing. – Asaf Apr 06 '14 at 17:47
  • 1
    I have no idea how the apollo paths can be in @INC some of the time and not others (unless there are two builds of `perl` involved, but I don't get the impression that it's case). – ikegami Apr 06 '14 at 17:54
  • 1
    @ikegami a perl alias or shell script could be mucking about with PERL5LIB and friends – ysth Apr 06 '14 at 18:01
  • 1
    seems like what you need to do is get some guidance from whoever runs the apollo stuff on how they install perl modules and how you should do so (if in fact you are even allowed to) – ysth Apr 06 '14 at 18:02
  • @ysth Yeah, all I really wanted to do was use a perl script to extract functions in vim (http://www.bofh.org.uk/2006/09/21/crossing-the-rubicon-again). I knew that there's some weird perl build specific things and I'm certainly allowed to do whatever I want on my computer, but it's sad that it's so complicated I need to go to them to solve what should be a simple problem. Thank you very much for your help. – Asaf Apr 06 '14 at 18:33
  • @ikegami I'm not a perl expert for sure, but I believe that there is at least a good chance I have multiple perl installations on my box. I'll check with someone on Monday about this issue. – Asaf Apr 06 '14 at 18:35
  • 2
    It's not complicated to fix. Just reinstall Perl. But that would mean losing your customizations, and we don't know what those are. – ikegami Apr 06 '14 at 18:49
  • 1
    if you just want to run a script for yourself, just build your own perl, completely separate from the already installed one(s). normally perlbrew makes this easy, but I suspect your setup will interfere with that too. – ysth Apr 06 '14 at 18:54
  • @ysth Well, in order to run that perl script I have a shebang line at the top. What if I installed a separate perl (somehow) and then just told the shebang line to run that different perl. If I could use an rpm to install the perl in a new location that "should" work. I may give it a try if I have time or I might just wait and ask a coworker who might be able to help tomorrow. – Asaf Apr 06 '14 at 20:31
  • On second thought, I could also just say in the script "use lib" and just make sure IO:All is in my path somewhere. Figuring out how to get it there correctly is another story since perl cpan is not working. And cpan has the nice feature of making sure all of IO:ALL's dependencies are there as well so this may not be as simple as it sounds. – Asaf Apr 06 '14 at 20:40

2 Answers2

5

I have this issue today. I compiled perl 5.14 and install to my home directory ($HOME/perl5.14/).

Because perl5.14 install some minimum perl5 libraries, you have to include the directory into $PERL5LIB=$HOME/perl5.14/usr/local/lib/perl5/5.14.2

Hope this works for you :)

benck
  • 2,034
  • 1
  • 22
  • 31
  • I appreciate your answer, but unfortunately I have no way to verify it. I eventually just recreated my virtual machine (because of a different problem) so the issue went away. Thanks for your help anyway. – Asaf Jun 02 '14 at 15:58
  • `make install` fixed the problem for me when building perl from source for use with perlbrew. I didn't even have to `perlbrew use` or change `PATH`! Thanks! – cxw Sep 29 '19 at 16:51
0

I also suspect that your cpan script is misconfigured. But perl -MCPAN uses the same config, so won't help you.

Installing an alternative CPAN client might help. I'd recommend cpanminus because it's very easy to install. Just run the following command (preferably while logged in as root):

curl -L http://cpanmin.us | perl - App::cpanminus

Now you should have cpanminus, you can use it to install IO::All:

cpanm -S -v IO::All
tobyink
  • 13,478
  • 1
  • 23
  • 35
  • I already had cpanminus installed, but I cannot install it using perl in the way you suggest. It fails with the same error as above, can't locate strict.pm. Instead I installed it using a directory downloaded binary I placed in my $PATH instead. But it doesn't matter if I'm using cpanm or regular cpan. I get the same error. The output is almost identical to the cpan one above so I will refrain from posting it. – Asaf Apr 05 '14 at 20:49