DBD::DB2 installation failing because of test using cpan on Strawberry Perl

ⅰ亾dé卋堺 提交于 2021-01-29 07:57:15

问题


I am very new to perl and I am trying to install DBD::DB2 module for perl on a windows PC using cpan but I keep getting this error:

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'.

I tried to copying the DBD::DB2 module form another computer but that did not work and gave me error Can't locate loadable object for module DBD::DB2::Constants in @INC Any help is appreciated.


回答1:


According to this technote, IBM India (possibly the maintainers of DBD:DB2) supports DBD:DB2 for Windows with ActiveState Perl. The technote also shows how to use ppm to get the pre-built module.

If you don't care about which Perl supplier , consider using Activestate Perl for Windows. If you must persist with Strawberry Perl, read on.

The current V11.1 Db2-LUW documentation also says in addition to ActiveState Perl, that 32-bit Strawberry-Perl is supported with this statement:

The working versions of Perl that works with Db2 are Activestate Perl and 32-bit Strawberry Perl. For 32-bit Strawberry Perl specifically, you must email opendev@us.ibm.com or contact IBM support for the required binaries.

If you have a support contract for Db2, you might want to check with them if the Db2 documentation is accurate (frequently for non-core stuff, it is inaccurate, out of date, misleading etc), and whether they can issue 64-bit binaries for DBD::DB2.

Looking at the CPAN page for changes to DBD:DB2, seems the most recent change was in 2012. So it is unclear if this module is maintained currently.

On the same site, there is also a reported issue opened in 2013, that DBD:DB2 fails to build with Strawberry perl.

I'm sure that a determined C programmer would be able to resolve the issue...the question is whether there are enough users to bother...




回答2:


I've found a work around for this, just insert this the following files:

  • 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

The full fix is here: https://github.com/ro-ag/DBD-DB2-1.86/commit/1ad9d4163656d9830fd567caf6d57603045ee392

You may also direct install it from a PPM package I've create for Windows 10: https://github.com/ro-ag/Perl-64-PPM/raw/master/PPM-64/DBD-DB2.tar.gz

The cpan module is forgotten i've sent several e-mails to IBM to include this fix without success.



来源:https://stackoverflow.com/questions/53672400/dbddb2-installation-failing-because-of-test-using-cpan-on-strawberry-perl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!