perl DBI 模块安装错误

发布于 2025-01-10 19:46:54 字数 2012 浏览 0 评论 0原文

perl DBI 模块安装出错。

使用 -Dinstallprefix 选项在非标准位置安装了 perl 5.32.1

./Configure -Dinstallprefix=/test/user/home/perl -des
make
make test
make install

/test/user/home/perl/bin/perl -version
This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux

设置 PERL5LIB 环境变量

export PERL5LIB="/test/user/home/perl/lib/5.32.1:/test/user/home/perl/lib/site_perl/5.32.1:/test/user/home/perl/lib/5.32.1/x86_64-linux"

which perl
/test/user/home/perl/bin/perl

下载了 DBI-1.643 存档,在提取执行 Makefile.PL 失败后

perl Makefile.PL

Warning: PERL_LIB (/perl/lib/5.32.1) seems not to be a perl library directory
        (strict.pm not found) at /test/user/home/perl/lib/5.32.1/ExtUtils/MM_Unix.pm line 1934.
Have /test/user/home/perl/lib/5.32.1/x86_64-linux
Want /perl/lib/5.32.1/x86_64-linux
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [x86_64-linux]
Config says: [x86_64-linux]
This may or may not cause problems. Please check your installation of perl
if you have problems building this extension.
Can't stat /perl/lib/5.32.1: No such file or directory
 at Makefile.PL line 280.
Can't stat /perl/lib/5.32.1/x86_64-linux: No such file or directory
 at Makefile.PL line 280.
Failed to opendir '/perl/lib/5.32.1/x86_64-linux/CORE' to find header files: No such file or directory at /test/user/home/perl/lib/5.32.1/ExtUtils/MM_Any.pm line 3048.

发现不存在的路径是从 @INC 引用的

perl -e "print \"@INC\""

/test/user/home/perl/lib/5.32.1 /test/user/home/perl/lib/site_perl/5.32.1 /test/user/home/perl/lib/5.32.1/x86_64-linux
/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1

有人可以指导我从 @INC 到哪里吗获取这些不存在的路径

/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1

是否有任何方法可以限制 @INC 附加不存在的路径?

perl DBI module installation is erroring out.

Installed perl 5.32.1 in non standard location, using -Dinstallprefix option

./Configure -Dinstallprefix=/test/user/home/perl -des
make
make test
make install

/test/user/home/perl/bin/perl -version
This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux

Set PERL5LIB env variable

export PERL5LIB="/test/user/home/perl/lib/5.32.1:/test/user/home/perl/lib/site_perl/5.32.1:/test/user/home/perl/lib/5.32.1/x86_64-linux"

which perl
/test/user/home/perl/bin/perl

Downloaded DBI-1.643 archive, after extraction execution of Makefile.PL is failing

perl Makefile.PL

Warning: PERL_LIB (/perl/lib/5.32.1) seems not to be a perl library directory
        (strict.pm not found) at /test/user/home/perl/lib/5.32.1/ExtUtils/MM_Unix.pm line 1934.
Have /test/user/home/perl/lib/5.32.1/x86_64-linux
Want /perl/lib/5.32.1/x86_64-linux
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [x86_64-linux]
Config says: [x86_64-linux]
This may or may not cause problems. Please check your installation of perl
if you have problems building this extension.
Can't stat /perl/lib/5.32.1: No such file or directory
 at Makefile.PL line 280.
Can't stat /perl/lib/5.32.1/x86_64-linux: No such file or directory
 at Makefile.PL line 280.
Failed to opendir '/perl/lib/5.32.1/x86_64-linux/CORE' to find header files: No such file or directory at /test/user/home/perl/lib/5.32.1/ExtUtils/MM_Any.pm line 3048.

Found non existing paths are referred from @INC

perl -e "print \"@INC\""

/test/user/home/perl/lib/5.32.1 /test/user/home/perl/lib/site_perl/5.32.1 /test/user/home/perl/lib/5.32.1/x86_64-linux
/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1

Can someone guide me where from @INC getting these non existing paths

/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1

are there any way to restrict @INC to append non existing paths?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江湖正好 2025-01-17 19:46:54

我认为您只需要 -Dprefix=/...。还有其他事情也需要放在正确的地方。不过,您不需要设置 PERL5LIB,因为 perl 应该使用您的前缀作为其默认 @INC。你的 perl -V 显示什么?

有一个installprefix,但它的目的是在一台机器上编译并在另一台机器上安装。但是, INSTALL 文档也建议不要使用它。这就是你想做的吗?

至于其他目录, INSTALL 文档描述了显示的各种目录在@INC 中。

I think you want just -Dprefix=/.... There are other things that need to end up in the right place too. You shouldn't need to set PERL5LIB though because perl should be using your prefix as its default @INC. What does your perl -V show?

There is an installprefix, but it's aimed at compiling on one machine and installing on another. However, the INSTALL docs also recommend against using that. Is that what you are trying to do?

As for the other directories, the INSTALL docs describe the various directories that show up in @INC.

涙—继续流 2025-01-17 19:46:54

谢谢@brian 为我指明了正确的方向。

以下是 @INC 包含不存在目录的根本原因。

上次在 perl 安装过程中,我至少运行了一次以下命令

./Configure -des -Dprefix=/perl

Use relocatable @INC? [n]
Pathname where the private library files will reside? (~name ok)
[/perl/lib/5.32.1]
Where do you want to put the public architecture-dependent libraries? (~name ok)
[/perl/lib/5.32.1/x86_64-linux]
Pathname for the site-specific library files? (~name ok)
[/perl/lib/site_perl/5.32.1]
Pathname for the site-specific architecture-dependent library files? (~name ok)
[/perl/lib/site_perl/5.32.1/x86_64-linux]

,然后执行了 make 命令。后来由于其他错误, make 测试失败。

然后,在不运行 make distclean 命令的情况下,我重新运行了配置
-Dinstallprefix 选项

./Configure -Dinstallprefix=/test/user/home/perl -des

按如下所示填充@INC

/test/user/home/perl/lib/5.32.1 /test/user/home/perl/lib/site_perl/5.32.1 /test/user/home/perl/lib/5.32.1/x86_64-linux
/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1

要修复此问题,请执行以下步骤,

make distclean  

./Configure -des -Dprefix=/test/user/home/perl -Dusethreads

现在 @INC 已正确填充

@INC:
    /test/user/home/perl/lib/site_perl/5.32.1/x86_64-linux-thread-multi
    /test/user/home/perl/lib/site_perl/5.32.1
    /test/user/home/perl/lib/5.32.1/x86_64-linux-thread-multi
    /test/user/home/perl/lib/5.32.1

现在 DBI 安装已成功运行。

Thank you @brian for pointing me in right direction.

Following was the root cause behind @INC contains non existing directories.

Last time during perl installation at least one time I ran following command

./Configure -des -Dprefix=/perl

Use relocatable @INC? [n]
Pathname where the private library files will reside? (~name ok)
[/perl/lib/5.32.1]
Where do you want to put the public architecture-dependent libraries? (~name ok)
[/perl/lib/5.32.1/x86_64-linux]
Pathname for the site-specific library files? (~name ok)
[/perl/lib/site_perl/5.32.1]
Pathname for the site-specific architecture-dependent library files? (~name ok)
[/perl/lib/site_perl/5.32.1/x86_64-linux]

then executed make command. Later on make test failed for other error.

Then without running make distclean command, I re ran Configure with
-Dinstallprefix option

./Configure -Dinstallprefix=/test/user/home/perl -des

This populate @INC as follows

/test/user/home/perl/lib/5.32.1 /test/user/home/perl/lib/site_perl/5.32.1 /test/user/home/perl/lib/5.32.1/x86_64-linux
/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1

To fix this issue executed following steps,

make distclean  

./Configure -des -Dprefix=/test/user/home/perl -Dusethreads

now @INC is populated correct

@INC:
    /test/user/home/perl/lib/site_perl/5.32.1/x86_64-linux-thread-multi
    /test/user/home/perl/lib/site_perl/5.32.1
    /test/user/home/perl/lib/5.32.1/x86_64-linux-thread-multi
    /test/user/home/perl/lib/5.32.1

Now DBI installation ran successfully.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文