cpan 安装模块 DBD::mysql 失败,雪豹

发布于 2024-08-18 14:57:38 字数 4081 浏览 2 评论 0 原文

我正在为 Koha 安装依赖项。这需要使用perl和cpan,这是我第一次。我通过 hivelogic 指令安装了 mysql。我在 32 位 mac mini 上运行 10.6.2。

这是终端输出:

John-Breedloves-Mac-mini:~ john_breedlove$ sudo -H cpan -i DBD::mysql
CPAN: Storable loaded ok (v2.19)
Going to read /var/root/.cpan/Metadata
  Database was generated on Tue, 19 Jan 2010 14:52:55 GMT
Running install for module 'DBD::mysql'
CPAN: YAML loaded ok (v0.71)
Running make for C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz
CPAN: Digest::SHA loaded ok (v5.48)
CPAN: Time::HiRes loaded ok (v1.9715)
  LWP not available

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
    http://www.perl.org/CPAN/authors/id/C/CA/CAPTTOFU/CHECKSUMS
Checksum for /var/root/.cpan/sources/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz ok
x DBD-mysql-4.013/
x DBD-mysql-4.013/lib/
x DBD-mysql-4.013/lib/DBD/
x DBD-mysql-4.013/lib/DBD/mysql.pm
x DBD-mysql-4.013/lib/DBD/mysql/
x DBD-mysql-4.013/lib/DBD/mysql/GetInfo.pm
x DBD-mysql-4.013/lib/DBD/mysql/INSTALL.pod
x DBD-mysql-4.013/lib/Bundle/
x DBD-mysql-4.013/lib/Bundle/DBD/
x DBD-mysql-4.013/lib/Bundle/DBD/mysql.pm
x DBD-mysql-4.013/mysql.xs
x DBD-mysql-4.013/dbdimp.c
x DBD-mysql-4.013/myld
x DBD-mysql-4.013/INSTALL.html
x DBD-mysql-4.013/Makefile.PL.embedded
x DBD-mysql-4.013/TODO
x DBD-mysql-4.013/README
x DBD-mysql-4.013/MANIFEST.SKIP
x DBD-mysql-4.013/ChangeLog
x DBD-mysql-4.013/Makefile.PL
x DBD-mysql-4.013/META.yml
x DBD-mysql-4.013/dbdimp.h
x DBD-mysql-4.013/eg/
x DBD-mysql-4.013/eg/prepare_memory_usage.pl
x DBD-mysql-4.013/eg/proc_example2b.pl
x DBD-mysql-4.013/eg/proc_example2.pl
x DBD-mysql-4.013/eg/decimal_test.pl
x DBD-mysql-4.013/eg/bug30033pg.pl
x DBD-mysql-4.013/eg/proc_example2a.pl
x DBD-mysql-4.013/eg/proc_example4.pl
x DBD-mysql-4.013/eg/bug21028.pl
x DBD-mysql-4.013/eg/bug14979.pl
x DBD-mysql-4.013/eg/bug30033.pl
x DBD-mysql-4.013/eg/issue21946.pl
x DBD-mysql-4.013/eg/proc_example3.pl
x DBD-mysql-4.013/eg/proc_example1.pl
x DBD-mysql-4.013/constants.h
x DBD-mysql-4.013/t/
x DBD-mysql-4.013/t/85init_command.t
x DBD-mysql-4.013/t/40listfields.t
x DBD-mysql-4.013/t/40bindparam.t
x DBD-mysql-4.013/t/mysql.mtest
x DBD-mysql-4.013/t/41bindparam.t
x DBD-mysql-4.013/t/76multi_statement.t
x DBD-mysql-4.013/t/40nulls.t
x DBD-mysql-4.013/t/32insert_error.t
x DBD-mysql-4.013/t/40catalog.t
x DBD-mysql-4.013/t/51bind_type_guessing.t
x DBD-mysql-4.013/t/40bindparam2.t
x DBD-mysql-4.013/t/41blobs_prepare.t
x DBD-mysql-4.013/t/20createdrop.t
x DBD-mysql-4.013/t/70takeimp.t
x DBD-mysql-4.013/t/42bindparam.t
x DBD-mysql-4.013/t/00base.t
x DBD-mysql-4.013/t/55utf8.t
x DBD-mysql-4.013/t/65types.t
x DBD-mysql-4.013/t/40server_prepare_error.t
x DBD-mysql-4.013/t/31insertid.t
x DBD-mysql-4.013/t/29warnings.t
x DBD-mysql-4.013/t/40types.t
x DBD-mysql-4.013/t/10connect.t
x DBD-mysql-4.013/t/lib.pl
x DBD-mysql-4.013/t/mysql.dbtest
x DBD-mysql-4.013/t/35limit.t
x DBD-mysql-4.013/t/71impdata.t
x DBD-mysql-4.013/t/40blobs.t
x DBD-mysql-4.013/t/40server_prepare.t
x DBD-mysql-4.013/t/40numrows.t
x DBD-mysql-4.013/t/35prepare.t
x DBD-mysql-4.013/t/40keyinfo.t
x DBD-mysql-4.013/t/75supported_sql.t
x DBD-mysql-4.013/t/60leaks.t
x DBD-mysql-4.013/t/50commit.t
x DBD-mysql-4.013/t/30insertfetch.t
x DBD-mysql-4.013/t/50chopblanks.t
x DBD-mysql-4.013/t/25lockunlock.t
x DBD-mysql-4.013/t/80procs.t
x DBD-mysql-4.013/MANIFEST
CPAN: File::Temp loaded ok (v0.20)

  CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz

Can't locate DBI/DBD.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 .) at Makefile.PL line 24.
Warning: No success on command[/opt/local/bin/perl Makefile.PL]
  CAPTTOFU/DBD-mysql-4.013.tar.gz
  /opt/local/bin/perl Makefile.PL -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install

I am installing dependancies for Koha. This is requiring perl and cpan usage, of which this is my first time. I installed mysql via the hivelogic instructions. I am running 10.6.2 on a 32bit mac mini.

Here is the terminal output:

John-Breedloves-Mac-mini:~ john_breedlove$ sudo -H cpan -i DBD::mysql
CPAN: Storable loaded ok (v2.19)
Going to read /var/root/.cpan/Metadata
  Database was generated on Tue, 19 Jan 2010 14:52:55 GMT
Running install for module 'DBD::mysql'
CPAN: YAML loaded ok (v0.71)
Running make for C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz
CPAN: Digest::SHA loaded ok (v5.48)
CPAN: Time::HiRes loaded ok (v1.9715)
  LWP not available

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
    http://www.perl.org/CPAN/authors/id/C/CA/CAPTTOFU/CHECKSUMS
Checksum for /var/root/.cpan/sources/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz ok
x DBD-mysql-4.013/
x DBD-mysql-4.013/lib/
x DBD-mysql-4.013/lib/DBD/
x DBD-mysql-4.013/lib/DBD/mysql.pm
x DBD-mysql-4.013/lib/DBD/mysql/
x DBD-mysql-4.013/lib/DBD/mysql/GetInfo.pm
x DBD-mysql-4.013/lib/DBD/mysql/INSTALL.pod
x DBD-mysql-4.013/lib/Bundle/
x DBD-mysql-4.013/lib/Bundle/DBD/
x DBD-mysql-4.013/lib/Bundle/DBD/mysql.pm
x DBD-mysql-4.013/mysql.xs
x DBD-mysql-4.013/dbdimp.c
x DBD-mysql-4.013/myld
x DBD-mysql-4.013/INSTALL.html
x DBD-mysql-4.013/Makefile.PL.embedded
x DBD-mysql-4.013/TODO
x DBD-mysql-4.013/README
x DBD-mysql-4.013/MANIFEST.SKIP
x DBD-mysql-4.013/ChangeLog
x DBD-mysql-4.013/Makefile.PL
x DBD-mysql-4.013/META.yml
x DBD-mysql-4.013/dbdimp.h
x DBD-mysql-4.013/eg/
x DBD-mysql-4.013/eg/prepare_memory_usage.pl
x DBD-mysql-4.013/eg/proc_example2b.pl
x DBD-mysql-4.013/eg/proc_example2.pl
x DBD-mysql-4.013/eg/decimal_test.pl
x DBD-mysql-4.013/eg/bug30033pg.pl
x DBD-mysql-4.013/eg/proc_example2a.pl
x DBD-mysql-4.013/eg/proc_example4.pl
x DBD-mysql-4.013/eg/bug21028.pl
x DBD-mysql-4.013/eg/bug14979.pl
x DBD-mysql-4.013/eg/bug30033.pl
x DBD-mysql-4.013/eg/issue21946.pl
x DBD-mysql-4.013/eg/proc_example3.pl
x DBD-mysql-4.013/eg/proc_example1.pl
x DBD-mysql-4.013/constants.h
x DBD-mysql-4.013/t/
x DBD-mysql-4.013/t/85init_command.t
x DBD-mysql-4.013/t/40listfields.t
x DBD-mysql-4.013/t/40bindparam.t
x DBD-mysql-4.013/t/mysql.mtest
x DBD-mysql-4.013/t/41bindparam.t
x DBD-mysql-4.013/t/76multi_statement.t
x DBD-mysql-4.013/t/40nulls.t
x DBD-mysql-4.013/t/32insert_error.t
x DBD-mysql-4.013/t/40catalog.t
x DBD-mysql-4.013/t/51bind_type_guessing.t
x DBD-mysql-4.013/t/40bindparam2.t
x DBD-mysql-4.013/t/41blobs_prepare.t
x DBD-mysql-4.013/t/20createdrop.t
x DBD-mysql-4.013/t/70takeimp.t
x DBD-mysql-4.013/t/42bindparam.t
x DBD-mysql-4.013/t/00base.t
x DBD-mysql-4.013/t/55utf8.t
x DBD-mysql-4.013/t/65types.t
x DBD-mysql-4.013/t/40server_prepare_error.t
x DBD-mysql-4.013/t/31insertid.t
x DBD-mysql-4.013/t/29warnings.t
x DBD-mysql-4.013/t/40types.t
x DBD-mysql-4.013/t/10connect.t
x DBD-mysql-4.013/t/lib.pl
x DBD-mysql-4.013/t/mysql.dbtest
x DBD-mysql-4.013/t/35limit.t
x DBD-mysql-4.013/t/71impdata.t
x DBD-mysql-4.013/t/40blobs.t
x DBD-mysql-4.013/t/40server_prepare.t
x DBD-mysql-4.013/t/40numrows.t
x DBD-mysql-4.013/t/35prepare.t
x DBD-mysql-4.013/t/40keyinfo.t
x DBD-mysql-4.013/t/75supported_sql.t
x DBD-mysql-4.013/t/60leaks.t
x DBD-mysql-4.013/t/50commit.t
x DBD-mysql-4.013/t/30insertfetch.t
x DBD-mysql-4.013/t/50chopblanks.t
x DBD-mysql-4.013/t/25lockunlock.t
x DBD-mysql-4.013/t/80procs.t
x DBD-mysql-4.013/MANIFEST
CPAN: File::Temp loaded ok (v0.20)

  CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz

Can't locate DBI/DBD.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.9 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.8.9/darwin-2level /opt/local/lib/perl5/5.8.9 .) at Makefile.PL line 24.
Warning: No success on command[/opt/local/bin/perl Makefile.PL]
  CAPTTOFU/DBD-mysql-4.013.tar.gz
  /opt/local/bin/perl Makefile.PL -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install

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

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

发布评论

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

评论(3

污味仙女 2024-08-25 14:57:39

线索就在您引用的输出的这一行中:

    Can't locate DBI/DBD.pm in @INC...

当您在 Perl 中开发时,您会经常看到这种类型的错误!这意味着您缺少模块依赖项,通常是因为尚未从 CPAN 安装该模块。

因此,您需要在 DBI::DBD ://search.cpan.org/perldoc/DBD::mysql" rel="noreferrer">DBD::mysql。有一些复杂的原因为什么< code>cpan 作为先决条件(通常在安装模块或发行版时,它会自动安装其所有依赖项):

PREREQ_PM 告诉 MakeMaker 该模块需要 DBI(本例中为版本 1.03)。如果有人尝试在没有 DBI 1.03 的情况下安装您的 DBD,则会发出警告,指出 DBI 1.03 缺失。请参阅下面的“配置”,了解为什么在未安装 DBI 的情况下,这不能可靠地阻止 cpan 测试仪使模块失败。

CONFIGURE 是 MakeMaker 在 WriteMakefile 期间调用的子例程。通过将 require DBI::DBD 放入此部分,我们可以尝试加载 DBI::DBD,但如果缺少它,我们会成功退出。当 DBI::DBD 缺失时,我们成功退出而不创建 Makefile,cpan 测试人员不会报告失败。这似乎与 PREREQ_PM 不一致,但 PREREQ_PM 不会导致 WriteMakefile 失败(除非您还指定 PREREQ_FATAL,这是 MakeMaker 强烈反对的),因此 WriteMakefile 将继续调用 dbd_dbi_arch_dir 并失败。

您可以使用以下命令同时安装两个模块:

    sudo -H cpan DBI::DBD DBD::mysql

The clue was in this line of your quoted output:

    Can't locate DBI/DBD.pm in @INC...

You'll be seeing this type of error a lot as you develop in Perl! It means that you are missing a module dependency, generally because the module hasn't been installed from CPAN.

Therefore, you need to install DBI::DBD first before DBD::mysql. There are some complicated reasons why this isn't installed automatically by cpan as a prerequisite (usually when installing a module or distribution, it will automatically install all its dependencies):

PREREQ_PM tells MakeMaker that DBI (version 1.03 in this case) is required for this module. This will issue a warning that DBI 1.03 is missing if someone attempts to install your DBD without DBI 1.03. See CONFIGURE below for why this does not work reliably in stopping cpan testers failing your module if DBI is not installed.

CONFIGURE is a subroutine called by MakeMaker during WriteMakefile. By putting the require DBI::DBD in this section we can attempt to load DBI::DBD but if it is missing we exit with success. As we exit successfully without creating a Makefile when DBI::DBD is missing cpan testers will not report a failure. This may seem at odds with PREREQ_PM but PREREQ_PM does not cause WriteMakefile to fail (unless you also specify PREREQ_FATAL which is strongly discouraged by MakeMaker) so WriteMakefile would continue to call dbd_dbi_arch_dir and fail.

You can install both modules at once with:

    sudo -H cpan DBI::DBD DBD::mysql
A君 2024-08-25 14:57:39

我花了一个晚上的大部分时间在谷歌上搜索并尝试各种方向来让 DBD::mysql 与我现有的 osx perl 安装一起工作。我没有取得任何进展,最后尝试安装活动 perl。它带有一个 perl 包管理器 (ppm)。从那里,您可以安装纯 perl mysql 驱动程序 (DBD::mysqlPP),这绕过了所有编译难题。 - 请务必更改您的代码以使用 DBD::mysqlPP 而不是 DBD::mysql - 就我而言,我更改了
这:
我的 $dsn = 'DBI:mysql:schemaName:localhost';

对此:
我的 $dsn = 'DBI:mysqlPP:schemaName:localhost';

I spent a most of an evening googleing and trying the various directions to get DBD::mysql to work with my existing osx perl installation. I was making no progress and finally tried installing active perl. It comes with a perl package manager (ppm). From there, you can install a pure perl mysql driver (DBD::mysqlPP) and this bypasses all the compilation headaches. - Just be sure to change your code to use DBD::mysqlPP rather than DBD::mysql - in my case, I changed
this:
my $dsn = 'DBI:mysql:schemaName:localhost';

to this:
my $dsn = 'DBI:mysqlPP:schemaName:localhost';

梅倚清风 2024-08-25 14:57:39

首先尝试安装 DBI.pm。

Try installing DBI.pm first.

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