FreeBSD 找不到模块 DBD::mysql 的可加载对象

Posted

技术标签:

【中文标题】FreeBSD 找不到模块 DBD::mysql 的可加载对象【英文标题】:FreeBSD Can't locate loadable object for module DBD::mysql 【发布时间】:2021-10-26 21:15:44 【问题描述】:

我安装了DBD::mysql,但是 Perl 无法识别它:

root@bsd:~ # freebsd-version
13.0-RELEASE

root@bsd:~ # perl -v

This is perl 5, version 34, subversion 0 (v5.34.0) built for amd64-freebsd

Copyright 1987-2021, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

root@bsd:~ # perl -MDBD::mysql -el
Can't locate loadable object for module DBD::mysql in @INC (@INC contains: /usr/lib/perl5/site_perl/5.34.0/amd64-freebsd /usr/lib/perl5/site_perl/5.34.0 /usr/lib/perl5/5.34.0/amd64-freebsd /usr/lib/perl5/5.34.0) at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.

root@bsd:~ # cpan CGI
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 26 Aug 2021 13:56:05 GMT
CPAN: Module::CoreList loaded ok (v5.20210520)
CGI is up to date (4.53).

root@bsd:~ # cpan DBD::mysql
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 26 Aug 2021 13:56:05 GMT
CPAN: Module::CoreList loaded ok (v5.20210520)
DBD::mysql is up to date (4.050).

【问题讨论】:

您可以尝试下载模块的the tar ball 并从源代码安装它吗?你有任何错误吗? 知道DBD::mysql 是如何安装的吗? 您是否在文件系统树中找到了DBD::mysql?您的@INC 是否包含此位置? 【参考方案1】:

我建议你从端口树安装它 - https://www.freshports.org/databases/p5-DBD-mysql/

【讨论】:

以上是关于FreeBSD 找不到模块 DBD::mysql 的可加载对象的主要内容,如果未能解决你的问题,请参考以下文章

DBD-mysql 已安装,但仍然出现错误“install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC”

FreeBSD下安装lua

搭建MHA时 yum 安装perl模块提示 baseurl 错误

DBD::mysql::st 执行失败:未知列

freebsd引导没有原来的系统,我原来是win7,又装了一个FreeBSD,一塌糊涂,连图形界

如何在自定义 @INC 中使用 DBI 构建 DBD::mysql?