【问题标题】:perl Can't locate loadable object for module Math::Pari in @INCperl 在 @INC 中找不到模块 Math::Pari 的可加载对象
【发布时间】:2013-05-07 15:51:48
【问题描述】:

我编写了一个 perl 脚本,它在我的环境中运行良好,但在我的客户端环境中却失败了:

Can't locate loadable object for module Math::Pari in @INC (@INC contains: Error-0.17020/lib        JSON-2.57/lib URI-1.60 libwww-perl-5.836/lib Net-Address-IP-Local-0.1.2/lib Math-GMP-2.06/ Net-     SSH-Perl-1.35/lib/ /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2  /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl  .) at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line 6
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line 6,  <GEN0> line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line  6,  <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util.pm line 56, <GEN0>  line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex/DH1.pm line 10,  <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex.pm line 6, <GEN0>  line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex.pm line 6,  <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/SSH2.pm line 6, <GEN0>  line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/SSH2.pm line 6,  <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl.pm line 52, <GEN0> line   1.
the user: ll was successfully added to the automation machine.notroot@ubuntu:~/autom    ation$ vim install.pl 

我尝试添加 使用库“数学”; 包含 Math-Pari-2.0305_01080605 模块的内容,但没有运气:/

我不希望我的客户自己安装 cpan 包 - 它应该是完全独立于环境的产品。

我宁愿避免从“Net-SSH-Perl-1.35”切换,因为我的大部分代码都依赖于它。

提前 10 倍!

更新: 我正在重写更新以澄清事情:

我的出发点是以下库:

use lib 'Net-SSH-Perl-1.35/lib/'; 
use lib 'Math-GMP-2.06/'; 
use lib 'Net-Address-IP-Local-0.1.2/lib';
use lib 'libwww-perl-5.836/lib';
use lib 'URI-1.60';
use lib 'JSON-2.57/lib';
use lib 'Error-0.17020/lib';
use Net::SSH::Perl;
use LWP::Simple;
use JSON qw( decode_json );
use POSIX qw/strftime/;
use Net::Address::IP::Local;

输出如下:

Can't locate Math/Pari.pm in @INC (@INC contains: Error-0.17020/lib JSON-2.57/lib URI-1.60 libwww-  perl-5.836/lib Net-Address-IP-Local-0.1.2/lib Math-GMP-2.06/ Net-SSH-Perl-1.35/lib/ /etc/perl    /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5     /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at Net-SSH-Perl-  1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line 6, <GEN0> line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line 6,  <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util.pm line 56, <GEN0> line   1.
 BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex/DH1.pm line 10  ,  <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex.pm line 6, <GEN0> line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex.pm line 6, <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/SSH2.pm line 6, <GEN0> line 1  .

BEGIN 失败--编译中止 ...

为了解决这个问题,我添加了下一条语句:

使用库'Math-Pari-2.010709';

错误改为:

Can't locate loadable object for module Math::Pari in @INC (@INC contains: Math-Pari-2.010709 Error- 0.17020/lib JSON-2.57/lib URI-1.60 libwww-perl-5.836/lib Net-Address-IP-Local-0.1.2/lib Math-GMP-2.06/  Net-SSH-Perl-1.35/lib/ /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5  /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at Net-SSH-Perl- 1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line 6
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line 6, <GEN0> line   1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util/SSH2MP.pm line 6, <GEN0>  line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Util.pm line 56, <GEN0> line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex/DH1.pm line 10, <GEN0>  line 1.
Compilation failed in require at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex.pm line 6, <GEN0> line 1.
BEGIN failed--compilation aborted at Net-SSH-Perl-1.35/lib//Net/SSH/Perl/Kex.pm line 6, <GEN0> line 1.
Compilation failed in require at Net-SSH-Perl-1....

这是 Math-Pari-2.010709 的内容:

drwxr-xr-x  3 notroot notroot 4096 May  7 14:38 ./
drwxr-xr-x 11 notroot notroot 4096 May  7 21:30 ../
drwxr-xr-x  7 notroot notroot 4096 May  7 14:38 Math/

Math-Pari-2.010709/数学:

total 240
drwxr-xr-x 7 notroot notroot  4096 May  7 14:38 ./
drwxr-xr-x 3 notroot notroot  4096 May  7 14:38 ../ 
-r--r--r-- 1 notroot notroot 27440 Oct 25  2006 Changes
-r--r--r-- 1 notroot notroot 17793 Feb  1  2004 func_codes.h
-r--r--r-- 1 notroot notroot  8676 Aug  9  2006 INSTALL 
drwxr-xr-x 2 notroot notroot  4096 Oct 25  2006 libPARI/
-r--r--r-- 1 notroot notroot  7573 Oct 25  2006 Makefile.PL
-r--r--r-- 1 notroot notroot   780 Nov 11  2005 MANIFEST
-r--r--r-- 1 notroot notroot   297 Oct 25  2006 META.yml
-r--r--r-- 1 notroot notroot  1322 Aug 23  2006 PariInit.pm
-r--r--r-- 1 notroot notroot 35680 Oct 25  2006 Pari.pm
-r--r--r-- 1 notroot notroot 79499 Oct 18  2006 Pari.xs
drwxr-xr-x 2 notroot notroot  4096 Oct 25  2006 patches/
-r--r--r-- 1 notroot notroot  4286 Jan 30  2004 README
drwxr-xr-x 2 notroot notroot  4096 Oct 25  2006 t/
drwxr-xr-x 2 notroot notroot  4096 Oct 25  2006 test_eng/
-r--r--r-- 1 notroot notroot  1142 Jan 20  2005 TODO
-r--r--r-- 1 notroot notroot  1361 Jul  8  2001 typemap
drwxr-xr-x 3 notroot notroot  4096 Oct 25  2006 utils/

我需要说明的是,Math-Pari-2.010709 中最初不存在 Math 文件夹,因此我创建了它并将 Math-Pari-2.010709 的内容移到其中,以便 perl 正在寻找位置。

在这个阶段,我添加了: 使用 Math::Pari

但似乎没有区别:

Can't locate loadable object for module Math::Pari in @INC (@INC contains: Math-Pari-2.010709 Error- 0.17020/lib JSON-2.57/lib URI-1.60 libwww-perl-5.836/lib Net-Address-IP-Local-0.1.2/lib Math-GMP-2.06/    Net-SSH-Perl-1.35/lib/ /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5  /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./install.pl  line 24
Compilation failed in require at ./install.pl line 24.
BEGIN failed--compilation aborted at ./install.pl line 24.

我总结了我迄今为止的所有尝试。

我将不胜感激!

【问题讨论】:

  • 你不应该做类似'use Pari;'之类的事情吗?在您的“使用 lib”声明之后?检查“使用”的文档
  • 您应该展示您的use 声明。您是否在 use lib 中提供了完整路径?
  • 所以您的perl 脚本位于所有这些路径的根目录?否则,您需要为这些添加完整路径。
  • @chrsblck,脚本确实位于所有这些路径的根目录
  • 我在您的“更新”中没有看到use Math::Pari。此外,我在您的 @INC 错误中没有看到 Math-Pari-2.010709 路径。你能确认这条路径是正确的吗?

标签: perl ssh cpan pari


【解决方案1】:

有许多 CPAN 发行版必须经过构建和安装过程;你不能只是从 CPAN 中解压文件并将 perl 指向它们。

Math::Pari 是一;它必须编译绑定到外部库(也必须存在)。

这种方法你运气不好。

【讨论】:

  • 任何人都可以保证@ysth的答案?
  • @GalMazor:ysth 说的是真的。
  • @GalMazor:如果您的机器具有您打算支持的每种架构,您可以安装所需的一切并将其与 pp (p3rl.org/pp) 捆绑在一起
  • (尽管我认为不会包含实际的 pari 库)
  • @ysth ,我需要在许多部署上得到支持,所以它不太实用......我已经接受了你的回答,但我不能投票给你,因为我的代表不到 15 岁 - 如果有人看到这个->赞成ysth :)
【解决方案2】:

您也许可以切换到Net::OpenSSH::Compat::Perl,它在 API 级别与大多数 Net::SSH::Perl 兼容,并且安装依赖项更少且更容易。

它唯一的非纯 Perl 依赖项是 IO::Pty 以支持密码验证和 OpenSSH ssh 二进制文件,该二进制文件已经安装在 Linux 和 BSD 系统的机器上,或者作为 Solaris 的软件包提供,可能其他几个unixen。

【讨论】:

    猜你喜欢
    • 2017-06-05
    • 1970-01-01
    • 2019-10-08
    • 2013-05-19
    • 1970-01-01
    • 2019-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多