如何在没有 root 访问权限的情况下在本地安装 CPAN 模块(DynaLoader.pm 第 229 行错误)?

2024-02-02

不能与其他模块一起使用,但举个例子。我使用 CPAN 设置安装了 Text::CSV_XS:

'makepl_arg' => q[PREFIX=~/lib],

当我尝试运行 test.pl 脚本时:

$ perl 测试.pl

#!/usr/bin/perl

use lib "/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi";

use Text::CSV_XS;

print "test";

I get



Can't load '/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so' for module Text::CSV_XS: /homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Text/CSV_XS/CSV_XS.so: cannot open shared object file: No such file or directory at /www/common/perl/lib/5.8.2/i686-linux/DynaLoader.pm line 229.
at test.pl line 6
Compilation failed in require at test.pl line 6.
BEGIN failed--compilation aborted at test.pl line 6.
  

我将错误追溯到 DynaLoader.pm 它发生在这一行:

# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
# C code of the extension XS file. Perl reports the error as being
# in this perl code simply because this was the last perl code
# it executed.

my $libref = dl_load_file($file, $module->dl_load_flags) or
    croak("Can't load '$file' for module $module: ".dl_error());

上述目录中存在CSV_XS.so


当您安装该模块时,您观察了输出吗?哪里说安装了模块?查看lib。您看到您期望的下一个目录了吗?

查看 ~/lib 以查看所有内容的最终位置,以验证您的目录名称是否正确use lib陈述:

% find ~/lib -name CSV_XS.so

一旦您看到它的安装位置,请在您的目录中使用该目录名称use lib(或 PERL5LIB 或其他)。

我希望你有一个lib/lib以某种方式在那里。这PREFIX只是前缀,安装程序会将其他目录部分附加到该基本路径。其中包括 lib、man、bin 等。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在没有 root 访问权限的情况下在本地安装 CPAN 模块(DynaLoader.pm 第 229 行错误)? 的相关文章

随机推荐