http://www.perlmonks.org?node_id=550508

jplindstrom has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to install a module which uses Module::Build on a Red Hat Enterprise Linux ES release 3 (Taroon Update 4) machine. However, installing Module::Build itself fails with the following message:

# running Build.PL Can't locate the perl binary used to run this script in (/usr/bin /usr +/bin /usr/bin /usr/kerberos/sbin /usr/kerberos/bin /usr/local/sbin /u +sr/local/bin /sbin /bin /usr/sbin /usr/bin /usr/X11R6/bin /root/bin)

Googling that error message only gives me the source page of Module::Build on search.cpan.org :)

So I have read the code in Module::Build but not researched further what it could be; I thought I'd ask whether this rings a bell for anyone before spending any more time.

Environment:

which perl /usr/bin/perl

perl -V ... /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0

/J

Replies are listed 'Best First'.
Re: Module::Build can't locate the perl binary (-d)
by tye (Sage) on May 19, 2006 at 16:07 UTC

    I went to search.cpan.org, selected the Module::Build distribution, then 'tools', grepped the release for 'binary' (or 'locate'), found the error was in Build/Base.pm, went "Back" a few times, selected 'Browse', then 'lib', then 'Module', then 'Build', then 'Base.pm' and found that the error message was from find_perl_interpretter() and that the failing code is likely contained there as well.

    Next I'd do "perl -d Build.PL" then "c Module::Build::Base::find_perl_interpretter" then see why it fails. YMMV, but trying to debug a problem in your environment from my environment is something that I find is usually a real pain. (:

    - tye        

Re: Module::Build can't locate the perl binary
by hesco (Deacon) on May 19, 2006 at 15:31 UTC
    Does your Build.PL contain a valid #!/usr/bin/perl -w line? -- Hugh

    if( $lal && $lol ) { $life++; }
Re: Module::Build can't locate the perl binary
by pigal (Novice) on Nov 30, 2006 at 11:40 UTC
    Hi, I had the same problem (btw. very annoying problem). After analisys of this #$%^&*!!! and test ALL posibilities checked in magic sub "find_perl_interpretter" to find /usr/bin/perl I decided to insert 1 simple line at the begining of this sub:
     return "/usr/bin/perl";
    After then I just ignore funny warning "* WARNING: Configuration was initially created with '/usr/bin/perl', but we are now using '/usr/bin/perl'." because of its stupidity. Works wonderfully.

    !!!Note: if you don't know wher is your perl do not try do this!!!

      Elementary debugging skills tell me that the problem is then with the few-line sub _perl_is_same. Which means that the string from Config->myconfig() isn't eq when dragged through print and qx.

      Given that this is a little-seen problem and involves RedHat, my first guess would be a UTF problem. But I'm sure Ken would appreciate someone who has this distribution getting a dump of the two versions of the string involed. I'd find that trivial to do with the Perl debugger but one could also just insert some warn Dump Config->myconfig() or such code. (I don't have RedHat handy.)

      - tye        

      Ya'know, I just can't help but wonder if this has any relation to the subject of (OT) Fixing Line Endings? If the perl binary value _was_ picked up from a #! line, could that line have been 'corrupted' similarly?
Re: Module::Build can't locate the perl binary
by kwilliams (Sexton) on Jun 28, 2007 at 02:06 UTC

    This turned out to be Yet Another RedHat Locale Problem, the user setting LC_ALL to C solved it. I sort of wonder whether we could do that right in the perl_is_same() method of M::B, but this would probably mess up people who actually know what they're doing with locales.

    -Ken

Re: Module::Build can't locate the perl binary
by kwilliams (Sexton) on Jun 15, 2007 at 02:26 UTC
    If someone finds the answer to this, please let me know, or better yet post to its RT ticket: http://rt.cpan.org/Public/Bug/Display.html?id=27576 Determining the path of the currently running perl binary is a notoriously yucky problem, but until now it had been quite a while since I'd seen a system on which the current find_perl_interpreter() fails. -Ken
Re: Module::Build can't locate the perl binary
by kwilliams (Sexton) on Jun 15, 2007 at 02:55 UTC

    If someone finds the answer to this, please let me know, or better yet post to its RT ticket:

    http://rt.cpan.org/Public/Bug/Display.html?id=27576

    Determining the path of the currently running perl binary is a notoriously yucky problem, but until now it had been quite a while since I'd seen a system on which the current find_perl_interpreter() fails.

    -Ken
      Oopsie, sorry about the double post, I thought I'd caught the first malformatted one in time.
Re: Module::Build can't locate the perl binary
by Anonymous Monk on Jan 30, 2008 at 13:09 UTC
    On my RH9 system I typed LC_ALL=C; export LC_ALL as root. After that everything worked.
      Kudos - was searching for the same problem and this fixed it for me. Thanks! -> Lance