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 附加不存在的路徑?
uj5u.com熱心網友回復:
我想你想要的只是-Dprefix=/.... 還有其他事情也需要在正確的地方結束。您不需要設定PERL5LIB,因為 perl 應該使用您的前綴作為默認值@INC。你的perl -V節目是什么?
有一個installprefix,但它的目的是在一臺機器上編譯并在另一臺機器上安裝。但是,安裝檔案也建議不要使用它。那是你想要做的嗎?
至于其他目錄,INSTALL檔案描述了出現在@INC.
uj5u.com熱心網友回復:
感謝@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 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 安裝運行成功。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/439355.html
