How to install DBI and other modules on msysgit (on Windows 7)?

817 Views Asked by At

I'm trying to install the DBI perl module on my Windows 7 machine, using Git for Windows, ie. msysgit, and the version of perl that ships with it.

I've been able to install a few other perl modules, but when I try to install DBI (via perl -MCPAN -e "install DBI"), the build process bombs out with the following error:

"/usr/bin/perl.exe" "/usr/share/perl5/core_perl/ExtUtils/xsubpp"  -typemap "/usr/share/perl5/core_perl/ExtUtils/typemap" -typemap "typemap"  Perl.xs > Perl.xsc && mv Perl.xsc Perl.c

gcc -c   -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -DUSEIMPORTLIB -march=x86-64 -mtune=generic -O2 -pipe   -DVERSION=\"1.636\" -DXS_VERSION=\"1.636\"  "-I/usr/lib/perl5/core_perl/CORE"  -W -Wall -Wpointer-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter Perl.c

In file included from DBIXS.h:23:0,
             from Perl.xs:7:
C:/git-sdk-64/usr/lib/perl5/core_perl/CORE/perl.h:805:25: fatal error: sys/wait.h: No such file or directory
      #   include <sys/wait.h>
                     ^
compilation terminated.
make: *** [Makefile:627: Perl.o] Error 1
 TIMB/DBI-1.636.tar.gz
 /usr/bin/make -- NOT OK

I get a similar error when I try to install Text::CSV_XS.

Based on what I've read elsewhere, I'm assuming that I'm missing something in my build environment. I've installed all the development metapackages mentioned on the msysgit documentation without any luck.

I'm not opposed to somehow building the module without using cpan, but I don't know how to troubleshoot the error I'm getting, let alone take on building something new. Suggestions?

2

There are 2 best solutions below

0
crazybilly On BEST ANSWER

mysysgit does not provide a full build environment. Thus, the best solution is to install another version of Perl (Strawberry Perl or Active Perl, for example) and alter your path so that mysysgit uses that perl rather than the one that comes built in.

0
Joseph Martin On

I have Git-for-Windows SDK installed along with Strawberry Perl. I use this bash function (your Strawberry Perl installation dir may be different):

#!/bin/bash
#echo sperl
function sperl {
    local pargs=("$@") PP="/c/Strawberry" # PP="$HOME/SwPerl64/ZIP"
    (
    export PATH="$PP/c/bin:$PP/perl/site/bin:$PP/perl/bin:$PATH"
    perl "${pargs[@]}"
    )
}

I also have something like this in my path as sperl.sh:

#!/bin/bash
export PATH="$PATH:$HOME/bin"
#
function sperl {
    local pargs=("$@") PP="/c/Strawberry" # PP="$HOME/SwPerl64/ZIP"
    (
    export PATH="$PP/c/bin:$PP/perl/site/bin:$PP/perl/bin:$PATH"
    perl "${pargs[@]}"
    )
}
#
sperl "$@"

This allows scripts like this:

#!/bin/env sperl.sh
use DBI;
use strict;
use warnings;
print "Hello World!\n";