如何在 msysgit (Windows 7) 上安装 DBI 和其他模块?
How to install DBI and other modules on msysgit (on Windows 7)?
我正在尝试在我的 Windows 7 机器上安装 DBI perl 模块,对 Windows 使用 Git,即。 msysgit,以及它附带的 perl 版本。
我已经能够安装一些其他的 perl 模块,但是当我尝试安装 DBI(通过 perl -MCPAN -e "install DBI"
)时,构建过程因以下错误而崩溃:
"/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
我在尝试安装 Text::CSV_XS 时遇到了类似的错误。
根据我在别处读到的内容,我假设我的构建环境中遗漏了一些东西。我已经安装了所有 development metapackages mentioned on the msysgit documentation,但没有任何运气。
我不反对在不使用 cpan 的情况下以某种方式构建模块,但我不知道如何解决我遇到的错误,更不用说构建新的东西了。建议?
mysysgit 不提供完整的构建环境。因此,最好的解决方案是安装另一个版本的 Perl(例如 Strawberry Perl 或 Active Perl)并更改您的路径,以便 mysysgit 使用该 perl 而不是内置的 perl。
我安装了 Git-for-Windows SDK 和 Strawberry Perl。我使用这个 bash 函数(你的 Strawberry Perl 安装目录可能不同):
#!/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[@]}"
)
}
我的路径中也有类似的东西 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 "$@"
这允许这样的脚本:
#!/bin/env sperl.sh
use DBI;
use strict;
use warnings;
print "Hello World!\n";
我正在尝试在我的 Windows 7 机器上安装 DBI perl 模块,对 Windows 使用 Git,即。 msysgit,以及它附带的 perl 版本。
我已经能够安装一些其他的 perl 模块,但是当我尝试安装 DBI(通过 perl -MCPAN -e "install DBI"
)时,构建过程因以下错误而崩溃:
"/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
我在尝试安装 Text::CSV_XS 时遇到了类似的错误。
根据我在别处读到的内容,我假设我的构建环境中遗漏了一些东西。我已经安装了所有 development metapackages mentioned on the msysgit documentation,但没有任何运气。
我不反对在不使用 cpan 的情况下以某种方式构建模块,但我不知道如何解决我遇到的错误,更不用说构建新的东西了。建议?
mysysgit 不提供完整的构建环境。因此,最好的解决方案是安装另一个版本的 Perl(例如 Strawberry Perl 或 Active Perl)并更改您的路径,以便 mysysgit 使用该 perl 而不是内置的 perl。
我安装了 Git-for-Windows SDK 和 Strawberry Perl。我使用这个 bash 函数(你的 Strawberry Perl 安装目录可能不同):
#!/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[@]}"
)
}
我的路径中也有类似的东西 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 "$@"
这允许这样的脚本:
#!/bin/env sperl.sh
use DBI;
use strict;
use warnings;
print "Hello World!\n";