我正在尝试安装一个具有各种 perl 依赖项的程序。 Perl 依赖项之一 (BerkeleyDB) 在安装过程中失败。我对perl知之甚少。我(作为用户)有办法解决这个问题吗?是否有 SPAN 命令可以尝试早期版本?
cpan[49]> install BerkeleyDB
Running install for module 'BerkeleyDB'
Fetching with HTTP::Tiny:
https://cpan.org/authors/id/P/PM/PMQS/BerkeleyDB-0.65.tar.gz
Checksum for /root/.local/share/.cpan/sources/authors/id/P/PM/PMQS/BerkeleyDB-0.65.tar.gz ok
Configuring P/PM/PMQS/BerkeleyDB-0.65.tar.gz with Makefile.PL
Parsing config.in...
Looks Good.
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -ldb
Generating a Unix-style Makefile
Writing Makefile for BerkeleyDB
Writing MYMETA.yml and MYMETA.json
PMQS/BerkeleyDB-0.65.tar.gz
/usr/bin/perl Makefile.PL -- OK
Running make for P/PM/PMQS/BerkeleyDB-0.65.tar.gz
cp BerkeleyDB/Hash.pm blib/lib/BerkeleyDB/Hash.pm
cp scan.pl blib/lib/scan.pl
cp BerkeleyDB.pod blib/lib/BerkeleyDB.pod
cp mkconsts.pl blib/lib/mkconsts.pl
cp BerkeleyDB/Btree.pm blib/lib/BerkeleyDB/Btree.pm
cp BerkeleyDB.pm blib/lib/BerkeleyDB.pm
Running Mkbootstrap for BerkeleyDB ()
chmod 644 "BerkeleyDB.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- BerkeleyDB.bs blib/arch/auto/BerkeleyDB/BerkeleyDB.bs 644
"/usr/bin/perl" "/usr/share/perl5/vendor_perl/ExtUtils/xsubpp" -noprototypes -typemap '/usr/share/perl5/ExtUtils/typemap' -typemap '/root/.local/share/.cpan/build/BerkeleyDB-0.65-0/typemap' BerkeleyDB.xs > BerkeleyDB.xsc
Warning: Found a 'CODE' section which seems to be using 'RETVAL' but no 'OUTPUT' section. in BerkeleyDB.xs, line 5936
Warning: Found a 'CODE' section which seems to be using 'RETVAL' but no 'OUTPUT' section. in BerkeleyDB.xs, line 5964
mv BerkeleyDB.xsc BerkeleyDB.c
gcc -c -I/usr/local/BerkeleyDB/include -D_REENTRANT -D_GNU_SOURCE -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -DVERSION=\"0.65\" -DXS_VERSION=\"0.65\" -fPIC "-I/usr/lib64/perl5/CORE" BerkeleyDB.c
BerkeleyDB.xs:76:10: fatal error: db.h: No such file or directory
76 | #include <db.h>
| ^~~~~~
compilation terminated.
make: *** [Makefile:349: BerkeleyDB.o] Error 1
PMQS/BerkeleyDB-0.65.tar.gz
/usr/bin/make -- NOT OK
Failed during this command:
PMQS/BerkeleyDB-0.65.tar.gz : make NO
答案1
如果您查看输出,您会注意到以下行:
BerkeleyDB.xs:76:10: fatal error: db.h: No such file or directory
构建是因为它缺少开发标头,并且很可能缺少提供它的包。
您还没有说明您正在使用什么操作系统,但在 Fedora、RHEL、Alma、Rocky 等中,您可以使用以下命令查看提供该文件的操作系统:
yum provides */db.h
dnf provides */db.h
这个相当直接,因为它会返回libdb-devel-5.3.28-53.el9.x86_64 : C development files for the Berkeley DB library
,这显然是您所需要的。
Debian、Ubuntu 等有点棘手。
您可以使用apt-file search db.h
它将返回带有该字符串的任何包,然后对其进行 grep,但您必须知道您在寻找什么。更好的选择是去https://packages.ubuntu.com并搜索包含该文件的包db.h
。您将看到包名称libdb5.3-dev
,并且使用apt show libdb5.3-dev
将返回以下几行,这使得它相当明显。
Description: Berkeley v5.3 Database Libraries [development]
This is the development package which contains headers and static
libraries for the Berkeley v5.3 database library.
该文件也很可能位于,/usr/include/db.h
因此您也可以使用
apt-file search /usr/include/db.h
哪个会返回
libdb5.3-dev: /usr/include/db.h
然后,安装该软件包,安装通过cpan
将起作用。