如何在 Cygwin 上从 CPAN 安装 Net::SSH2
Posted
技术标签:
【中文标题】如何在 Cygwin 上从 CPAN 安装 Net::SSH2【英文标题】:How to install Net::SSH2 from CPAN on Cygwin 【发布时间】:2015-02-09 21:30:24 【问题描述】:我需要在 Windows 7(64 位)下的 Cygwin 环境中安装 Net:SSH2
。像往常一样,我尝试使用cpanm
安装它。
我已经安装了必要的 Cygwin 包(见下文),但 Perl 构建失败,因为它找不到 libssh2
库。
Net::SSH2
包中有一个特殊的文本文件BUILDING.WIN32
,但这仅在手动构建模块时有用,它主要指的是 MinGW。所以这没有帮助。
这是构建的日志:
Entering Net-SSH2-0.53
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.59 ... Yes (7.02)
Running Makefile.PL
Configuring Net-SSH2-0.53 ... Subroutine checklibs redefined at inc/Module/Install/CheckLib.pm line 11.
Subroutine assertlibs redefined at inc/Module/Install/CheckLib.pm line 25.
Subroutine _author_side redefined at inc/Module/Install/CheckLib.pm line 39.
The libssh2 library is required by this module. If you don't have it, you can
download it from http://www.libssh2.org; you may also need OpenSSL, which can
be obtained from http://www.openssl.org , or libgcrypt, which can be obtained
from http://www.gnupg.org .
Debian: sudo aptitude install libssh2-1-dev
OpenSUSE: sudo zypper in libssh2-1 libssh2-devel
You can pass your libssh2 lib and include dirs (and extra link args) on the
command line. E.g.:
perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include \
ldargs="-lz"
These can also be set through the LIBSSH2_LIB/LIBSSH2_INCLUDE/LIBSSH2_LDARGS
environment variables.
To build with libgcrypt instead of OpenSSL, pass 'gcrypt' as a parameter to
Makefile.PL, e.g.:
perl Makefile.PL gcrypt
If you want to build on Windows, see the file BUILDING.WIN32 in the
distribution.
Can't link/include C library 'ssh2', aborting.
【问题讨论】:
【参考方案1】:首先从 Cygwin 安装 libssh2-devel
包,例如使用 apt-cyg
命令行前端,用于从 cygwin shell 中安装软件包。
apt-cyg install libssh2-devel
然后将一些环境变量设置为正确的路径,以使 Net::SSH2
与 Cygwin 包一起使用:
LIBSSH2_LIB=/usr/lib/ LIBSSH2_INCLUDE=/usr/include/ cpanm -v Net::SSH2
这对我有用。比上面链接的自述文件看起来要容易得多。
【讨论】:
以上是关于如何在 Cygwin 上从 CPAN 安装 Net::SSH2的主要内容,如果未能解决你的问题,请参考以下文章
无法在 Linux 上使用 cpan/cpanm 安装 Net::Pcap
无法使用 CPAN 安装 Net::SSLeay: /bin/sh: x86_64-apple-darwin13.4.0-clang: command not found
如何通过 CPAN 模块 Net-OpenSSH 设置 GSSAPIAuthentication 和 GSSAPIDelegateCredentials 属性