【问题标题】:DBD::DB2 installation failing because of test using cpan on Strawberry PerlDBD::DB2 安装失败,因为在 Strawberry Perl 上使用 cpan 进行测试
【发布时间】:2021-09-29 20:36:13
【问题描述】:

我对 perl 非常陌生,我正在尝试使用 cpan 在 Windows PC 上安装用于 perl 的 DBD::DB2 模块,但我不断收到此错误:

CPAN: CPAN::SQLite loaded ok (v0.212)
Database was generated on Thu, 06 Dec 2018 20:55:19 GMT

Running install for module 'DBD::DB2'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.081)
Checksum for D:\STRAWB~1\cpan\sources\authors\id\I\IB\IBMTORDB2\DBD-DB2-1.85.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.32)
CPAN: YAML::XS loaded ok (v0.75)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
Configuring I/IB/IBMTORDB2/DBD-DB2-1.85.tar.gz with Makefile.PL

Configuring DBD::DB2...
Remember to actually read the README and CAVEATS files!

Using DB2 in "D:/SQLLIB"
System: perl5.028001 DBI1.642 Win32 strawberry-perl 5.28.1.1 #1 Sun Dec  2 14:24:00 2018 x64 MSWin32-x64-multi-thread dl_win32.xs
Compiler: gcc -s -O2  -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields
Includes:  -I"D:/SQLLIB/include" -I"D:\STRAWB~1\perl\site\lib/auto/DBI" -I"D:\STRAWB~1\perl\lib/auto/DBI" -I"D:\STRAWB~1\perl\vendor\lib/auto/DBI" -I"D:\STRAWB~1\perl\site\lib/auto/DBI" 
Libraries: -L"D:/SQLLIB/lib" db2cli.lib db2api.lib

Checking if your kit is complete...
Looks good
Checking if your kit is complete...
Looks good
Writing MYMETA.yml and MYMETA.json
Generating a gmake-style Makefile
Writing Makefile for DBD::DB2
Writing MYMETA.yml and MYMETA.json
IBMTORDB2/DBD-DB2-1.85.tar.gz
D:\Strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for I/IB/IBMTORDB2/DBD-DB2-1.85.tar.gz
CPAN: Module::CoreList loaded ok (v5.20181130)
cp DB2.pm blib\lib\DBD\DB2.pm
cp DB2.pod blib\lib\DBD\DB2.pod
cp lib/Bundle/DBD/DB2.pm blib\lib\Bundle\DBD\DB2.pm
gmake[1]: Entering directory 'D:/STRAWB~1/cpan/build/DBD-DB2-1.85-10/Constants'
AutoSplitting ..\blib\lib\DBD\DB2\Constants.pm     (..\blib\lib\auto\DBD\DB2\Constants)
Running Mkbootstrap for Constants ()
"D:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644     "Constants.bs"
"D:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- Constants.bs    ..\blib\arch\auto\DBD\DB2\Constants\Constants.bs 644
"D:\Strawberry\perl\bin\perl.exe"    "D:\Strawberry\perl\lib\ExtUtils/xsubpp"  -typemap   D:\STRAWB~1\perl\lib\ExtUtils\typemap  Constants.xs > Constants.xsc
"D:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- Constants.xsc Constants.c
gcc -c -I"D:/SQLLIB/include" -I"D:\STRAWB~1\perl\site\lib/auto/DBI" -I"D:\STRAWB~1\perl\lib/auto/DBI" -I"D:\STRAWB~1\perl\vendor\lib/auto/DBI" -I"D:\STRAWB~1\perl\site\lib/auto/DBI"   -I"D:/SQLLIB/include" -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"1.85\" -DXS_VERSION=\"1.85\"  "-ID:\STRAWB~1\perl\lib\CORE" -   DDB2_CACHE_FIX    Constants.c
gmake[1]: Leaving directory 'D:/STRAWB~1/cpan/build/DBD-DB2-1.85-10/Constants'
IBMTORDB2/DBD-DB2-1.85.tar.gz
D:\STRAWB~1\c\bin\gmake.exe -- NOT OK
Stopping: 'install' failed for 'DBD::DB2'.

我尝试从另一台计算机复制 DBD::DB2 模块,但没有成功,并出现错误 Can't locate loadable object for module DBD::DB2::Constants in @INC 任何帮助表示赞赏。

【问题讨论】:

  • 问题可能出在gmake的使用上。在 Unix 上,我建议创建一个别名 gmake=make。在 Windows 上,我不知道临时修复。
  • 我对缺少错误消息感到困惑。当然,gmake 失败了,但为什么呢?可能是因为它试图执行的某个程序返回了一个错误,但是是哪一个,为什么它没有产生错误消息?我想有一些开关可以传递给gmake 更详细...
  • 顺便问一下,您能确认D:/SQLLIB 存在并且DB2 驱动程序文件在其中吗? (也许提供dir d:\sqllib产生的目录列表?)
  • D:\SQLLIB 存在`,D:\SQLLIB\include 和 D:\SQLLIB\lib 目录列表对于评论部分来说太大了

标签: perl db2


【解决方案1】:

根据technote,IBM 印度(可能是 DBD:DB2 的维护者)支持带有 ActiveState Perl 的 DBD:DB2 for Windows。该技术说明还展示了如何使用 ppm 来获取预构建模块。

如果您不关心 Perl 供应商,请考虑使用 Activestate Perl for Windows。如果您必须坚持使用 Strawberry Perl,请继续阅读。

当前的 V11.1 Db2-LUW documentation 还表示,除了 ActiveState Perl 之外,此声明还支持 32 位 Strawberry-Perl:

与 Db2 一起使用的 Perl 的工作版本是 Activestate Perl 和 32 位草莓 Perl。特别是对于 32 位草莓 Perl, 您必须发送电子邮件至 opendev@us.ibm.com 或联系 IBM 支持以获取 所需的二进制文件。

如果您有 Db2 的支持合同,您可能希望与他们核实 Db2 文档是否准确(通常对于非核心内容,它不准确、过时、误导等),以及他们是否可以发布DBD::DB2 的 64 位二进制文​​件。

查看CPAN 页面以了解对 DBD:DB2 的更改,最近的更改似乎是在 2012 年。因此目前尚不清楚此模块是否仍在维护。

在同一站点上,还报告了 2013 年开放的 issue,指出 DBD:DB2 无法使用 Strawberry perl 构建。

我确信一个坚定的 C 程序员能够解决这个问题......问题是是否有足够的用户来打扰......

【讨论】:

  • 嗨,毛,我尝试了 ppm 安装,但失败并出现错误:PPM install failed: The PPD does not provide code to install for this platform 当我尝试运行 ppm install http://www.bribes.org/perl/ppm/DBD-DB2.ppd 和 ppm install http://www.bribes.org/perl/ppm64/DBD-DB2.ppd 我也尝试了 CPAN install DBD::DB2,它说我的DB2 实例。当前运行 Db2 11.1.4fp4
  • 如果仍然安装了 Strawberry-Perl,那么您还没有理解答案。如果您已经切换到 ActiveState Perl,那么您应该创建一个新问题。
【解决方案2】:

我找到了解决方法,只需插入以下文件:

  • Constants/Constants.xs
  • DB2.h
 #ifndef __DBD_DBI_FIX__
 #define __DBD_DBI_FIX__
     #include <specstrings.h>
     #ifndef __out_ecount_opt
         #define __out_ecount_opt    SAL__out_ecount_opt
     #endif
     #ifndef __in_ecount_opt
         #define __in_ecount_opt  SAL__in_ecount_opt
     #endif
     #ifndef __out_bcount_opt
         #define __out_bcount_opt    SAL__out_bcount_opt
     #endif
 #endif

完整的修复在这里: https://github.com/ro-ag/DBD-DB2-1.86/commit/1ad9d4163656d9830fd567caf6d57603045ee392

您也可以直接从我为 Windows 10 创建的 PPM 包中安装它: https://github.com/ro-ag/Perl-64-PPM/raw/master/PPM-64/DBD-DB2.tar.gz

cpan 模块被忘记了,我已向 IBM 发送了几封电子邮件以包含此修复,但均未成功。

【讨论】:

    【解决方案3】:

    不是anwser,而是一个问题。您的 DBD-DB2-tar.gz 缺少草莓 perl 安装所需的 PPD 文件。

    【讨论】:

    • 答案是为了答案。如果您要问一个明确的问题,请尝试使用 cmets。
    猜你喜欢
    • 2015-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-11
    相关资源
    最近更新 更多