twiki "Failed to load the perl module FindBin." - perl

I am trying to get TWIKI to work (virtual Server Hosteurope .. PLESK 11 CentOS 6).
When I run the configure script the following error appears:
[root#lvpsx.x.x.x bin]# ./configure
Failed to load the perl module FindBin. The module was found at /usr/share/perl5/FindBin.pm
Please ensure that:
1 FindBin is installed,
2 that the module is available on the #INC path,
3 that the webserver user (root) has permission to read the FindBin.pm file.
The detailed error seen was:
Subroutine export_fail redefined at /usr/share/perl5/Carp.pm line 25.
Compilation failed in require at /usr/share/perl5/FindBin.pm line 95.
BEGIN failed--compilation aborted at /usr/share/perl5/FindBin.pm line 95.
Compilation failed in require at (eval 3) line 2.
BEGIN failed--compilation aborted at (eval 3) line 2.
I have only marginal knowledge about the usage of shells and much less experience with Perl.
I run the configure script as root. As Far as I know Apache runs as root too(PLESK 11).
FindBin.pm is located in the named dir and I already tried to set it to 777.

Try installing VMS::Filespec, which seems to be the module FindBin is trying to require.
On the shell:
cpanm VMS::Filespec
If that doesn't work (the command fails), then try first:
cpan App::cpanminus
...and then try the first command again.
HTH
Francisco

Related

Issue while installing DBI Perl module in Solaris 11

I am trying to install Perl DBI module on Solaris 11 manually using Make install:
You can verify the steps mentioned below.
/usr/perl5/5.12/ModulesTars/DBI-1.643# make test
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty'
-- DBI.bs blib/arch/auto/DBI/DBI.bs 644
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-Iblib/lib" "-Iblib/arch" test.pl
test.pl
DBI test application $Revision$
Can't load '/usr/perl5/5.12/ModulesTars/DBI-1.643/blib/arch/auto/DBI/DBI.so'
for module DBI: ld.so.1: perl:
fatal: /usr/perl5/5.12/ModulesTars/DBI-1.643/blib/arch/auto/DBI/DBI.so:
wrong ELF class: ELFCLASS64 at
/usr/perl5/5.12/lib/sun4-solaris-64int/DynaLoader.pm line 200.
at /usr/perl5/5.12/ModulesTars/DBI-1.643/blib/lib/DBI.pm line 284
BEGIN failed--compilation aborted at
/usr/perl5/5.12/ModulesTars/DBI-1.643/blib/lib/DBI.pm line 284.
Compilation failed in require at test.pl line 23.
BEGIN failed--compilation aborted at test.pl line 23.
*** Error code 2
make: Fatal error: Command failed for target `test_dynamic'
/usr/perl5/5.12/ModulesTars/DBI-1.643#
Getting above error while running make test command. Please help to find the resolution.
Per Oracle's Solaris 11 Perl 5 documentation:
Perl 5 includes a dynamically loadable module framework, which allows the addition of new capabilities for specific tasks. Many modules are freely available from the Comprehensive Perl Archive Network (CPAN) at http://www.cpan.org. If you wish to build and install add-on modules from CPAN using gcc, you can do so using the /usr/perl5/5.8.4/bin/perlgcc or the /usr/perl5/5.12/bin/perlgcc script. See the perlgcc(1) man page with the 5.8.4 distribution for details.
Offtopic:
Given your comment
This is perl 5, version 12, subversion 5 (v5.12.5) built for sun4-solaris-64int (with 7 registered patches, see perl -V for more detail)
Are you really installing user-compiled modules as root into the system's Perl installation? Since you have "7 registered patches", it seems that this is a system under an Oracle support contract. Installing user-compiled modules as root into the system Perl installation risks your system's stability and likely violates your support contract.

Can't locate Text/Soundex.pm in #INC

I was installing repeatsmasker and it apparently seems to work because it shows "Congratulations! RepeatMasker is now ready to use."
But when I run it it reports "Can't locate Text/Soundex.pm...". so I installed the module by "sudo cpan Text::Soundex", and by the end it tells me "Text::Soundex is up to date (3.05)." It seems the module is already installed, but RepeatMasker still has the same problem, as I'll show you in this code:
fragua#picci:~/RM/RepeatMasker$ sudo cpan Text::Soundex
Loading internal null logger. Install Log::Log4perl for logging messages
Reading '/home/fragua/.cpan/Metadata'
Database was generated on Fri, 19 Apr 2019 22:17:03 GMT
Text::Soundex is up to date (3.05).
fragua#picci:~/RM/RepeatMasker$ ./RepeatMasker -s -lib /home/fragua/RepeatScout-1.0.5/ObiINK5k_repeats_filtered1.fasta /home/fragua/Documenti/Workdirectory/ObiINC5k.fa
Can't locate Text/Soundex.pm in #INC (you may need to install the Text::Soundex module) (#INC contains: /home/fragua/RM/RepeatMasker /home/fragua/perl5/lib/perl5 /home/fragua/anaconda/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/fragua/anaconda/lib/site_perl/5.26.2 /home/fragua/anaconda/lib/5.26.2/x86_64-linux-thread-multi /home/fragua/anaconda/lib/5.26.2 .) at /home/fragua/RM/RepeatMasker/Taxonomy.pm line 80.
BEGIN failed--compilation aborted at /home/fragua/RM/RepeatMasker/Taxonomy.pm line 80.
Compilation failed in require at ./RepeatMasker line 310.
BEGIN failed--compilation aborted at ./RepeatMasker line 310.
I installed RepeatMasker in another computer without problems, but I don't know why now I encontered this problem
You have two builds of Perl installed:
/usr/bin/perl
/home/fragua/anaconda/bin/perl.
/home/fragua/anaconda/bin/perl is first in your PATH. This means that programs with the following shebang (#!) line will use /home/fragua/anaconda/bin/perl:
#!/usr/bin/env perl
RepeatMasker appears to be such a program.
All of this is fine.
The Problem
/home/fragua/anaconda/bin contains the scripts installed by /home/fragua/anaconda/bin/perl. As part of the installation process of these scripts, the shebang line of these scripts should have been rewritten to specify /home/fragua/anaconda/bin/perl.
However, the shebang line of /home/fragua/anaconda/bin/cpan references /usr/bin/perl. This means that using /home/fragua/anaconda/bin/cpan would install modules for /usr/bin/perl, not /home/fragua/anaconda/bin/perl.
The Workaround
You could avoid relying on the shebang line and explicitly specify the correct perl.
/home/fragua/anaconda/bin/perl /home/fragua/anaconda/bin/cpan Text::Soundex
Or, given your $PATH,
perl /home/fragua/anaconda/bin/cpan Text::Soundex
The Fix
To fix this problem in an ongoing manner requires changing the shebang lines of the scripts to be what they should be. In every file in /home/fragua/anaconda/bin (and in particular for cpan), replace
#!/usr/bin/perl
with
#!/home/fragua/anaconda/bin/perl
You could do this use the following (which does a backup of the files it changes):
perl -0777ne'print "$ARGV\n" if m{^#!\s*/usr/bin/perl\b}' /home/fragua/anaconda/bin/* \
| xargs perl -i~ -0777pe's{^#!\s*/usr/bin/perl\b}{#!/home/fragua/anaconda/bin/perl}'

Unable to load (and reinstall) Socket.pm after upgrade

I've just upgraded Slackware64 to 14.1 and I found Perl 5.18 in it. Socket.pm now complains that it was compiled for another Perl version, which was 5.16. Here is the error:
Perl API version v5.16.0 of Socket does not match v5.18.0 at /usr/share/perl5/XSLoader.pm line 92.
Unfortunately, I'm even unable to reinstall Socket.pm even with cpan.
$ cpan Socket
Reading '/home/francesco-salix/.cpan/Metadata'
Database was generated on Tue, 26 Nov 2013 09:08:12 GMT
Running install for module 'Socket'
Running make for P/PE/PEVANS/Socket-2.013.tar.gz
Checksum for /home/francesco-salix/.cpan/sources/authors/id/P/PE/PEVANS/Socket-2.013.tar.gz ok
CPAN.pm: Building P/PE/PEVANS/Socket-2.013.tar.gz
Attempt to reload Socket.pm aborted.
Compilation failed in require at /usr/share/perl5/IPC/Cmd.pm line 46.
BEGIN failed--compilation aborted at /usr/share/perl5/IPC/Cmd.pm line 46.
Compilation failed in require at /usr/share/perl5/ExtUtils/CBuilder/Base.pm line 11.
BEGIN failed--compilation aborted at /usr/share/perl5/ExtUtils/CBuilder/Base.pm line 11.
Compilation failed in require at /usr/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 4.
Compilation failed in require at (eval 6) line 2.
BEGIN failed--compilation aborted at (eval 6) line 2.
Compilation failed in require at Makefile.PL line 19.
Warning: No success on command[/usr/bin/perl5.18.1 Makefile.PL]
'YAML' not installed, will not store persistent state
PEVANS/Socket-2.013.tar.gz
/usr/bin/perl5.18.1 Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
As far as I've understood, Socket.pm is a Perl core module. So, I thought it would have been upgraded together with Perl.
Here are directories currently in #INC:
$ perl -E'say for #INC'
/home/francesco-salix/perl5/lib/perl5/x86_64-linux-thread-multi
/home/francesco-salix/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
.
I see some folders seems duplicate, but I don't actually know if they are supposed to be like that. However, there's no Socket.pm in the first two path (which I assume where added by cpan while running under my user, while I've a Socket.pm file for both /usr/local/lib64/perl5/ and /usr/lib64/perl5.
Socket.pm is indeed a core module. And the CPAN.pm moduleExtUtils::MakeMaker uses it (via IPC::Cmd), so if Socket.pm is broken, CPAN.pmMakefile.PL will be broken too.
Given that it is a core module, and would have been installed with Perl, this suggests to me that Perl is trying to load Socket.pm from some other, older path. The following will tell you where Perl is trying to load modules from:
perl -E'say for #INC'
Is there anything suspicious in there. Any place it might find older modules compiled for Perl 5.16?
The solution is to clear the old modules, following 3rensho’s comment:
sudo rm -rf /usr/local/lib64/perl5/*
sudo rm -rf /usr/local/share/perl5/*
It works!

Compiling perl source using pp

I have a perfectly functioning perl script (written in bash terminal on debian linux) that fails to execute (on either linux or windows) when compiled using pp. This may relate to unmet dependencies in the build, but I do believe the following command packages all dependencies into the executable:
pp -o out.exe in.pl
When I say it is perfectly functioning, I mean that the intended output is generated with no errors if I invoke ./in.pl from a bash terminal.
I would like to create an executable that will run on either linux or windows (if a separate file is required for each OS, so be it).
These are the packages that are included in the source:
use strict;
use warnings;
use charnames ":short";
binmode(STDOUT,":utf8");
use Term::ANSIColor;
use Number::Format;
use Finance::Quote;
use Finance::QuoteHist;
use Date::Manip; # this may be included by Finance::QuoteHist
If it helps, here is the error message I get (warning, it's long):
ERROR: [config_var] invalid zone in SetDate
ERROR: [config_var] invalid zone in SetDate
Could not load either Text::CSV_XS or Text::CSV_PP : Can't locate Text/CSV_PP.pm in #INC (#INC contains: CODE(0x1422320) /tmp/par-username/cache-addd1cc2ee9285c150584c1853c2b67c0c482e7e/inc/lib /tmp/par-username/cache-addd1cc2ee9285c150584c1853c2b67c0c482e7e/inc CODE(0x11675b0) CODE(0x116ebc8)) at (eval 30) line 2.
BEGIN failed--compilation aborted at (eval 30) line 2.
at Finance/QuoteHist.pm line 13
Compilation failed in require at Finance/QuoteHist.pm line 13.
BEGIN failed--compilation aborted at Finance/QuoteHist.pm line 13.
Compilation failed in require at script/in.pl line 10.
BEGIN failed--compilation aborted at script/in.pl line 10.
Judging from the run-time errors, the problem may relate to unmet recursive dependencies (for instance, dependencies within Finance::QuoteHist). Perhaps these recursive dependencies should be included explicitly? This is my first time attempting to compile perl into an executable, so thanks for any guidance you can provide.
You might try to use the -x flag to pp as seen in the docs. It runs the script and checks for dependencies as it goes, which is more accurate than simply scanning for dependencies. I have needed this when using Tk and it worked wonders.

Error using bytecode-compiling filter, PERL

When I compile using: pp -I lib -f Bytecode -o myapp_binary_bytecode myapp
I get this error:
"my" variable $fh masks earlier declaration in same scope at /Library/Perl/5.12/PAR/Filter/Bytecode.pm line 60.
Can't locate B/Bytecode.pm in #INC (#INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3/darwin-thread-multi-2level /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at (eval 1) line 18.
BEGIN failed--compilation aborted at (eval 1) line 18.
BEGIN failed--compilation aborted.
Cannot transform /var/folders/cd/rwsp63c15bb01r89z76_bvr40000gn/T/Q3ubgSUe8P to /var/folders/cd/rwsp63c15bb01r89z76_bvr40000gn/T/LIcOpNf_Oh: No such file or directory (512)
Although the compiled binary works, but how can I fix the error?
Thanks!
The error says you're trying to use a module Perl can't locate. The usual cause is that you don't have that module installed.
A lack of permissions to read the module file could also lead to that error, but that's almost never the problem.
Unrelatedly, I would look into that my problem. As to why the running binary still has that problem, pp can easily miss dependencies, but it has a dynamic way to counter that problem. Try running pp -x script and it will run the script to find any run-time dependencies. Also I think there's a switch for manually adding dependencies to the list.