当我尝试在我的 Debian 机器上安装 Net::SSH2 模块时,我得到了以下日志。我没有安装 libssh2-dev,但仍然收到此错误。它还说“找不到您的 C 编译器”。我很确定我确实安装了 C 编译器。我该如何修复这个问题?
cpan Net::SSH2
CPAN: Storable loaded ok (v2.20)
Going to read '/root/.cpan/Metadata'
Database was generated on Wed, 07 Jan 2015 22:53:20 GMT
Running install for module 'Net::SSH2'
CPAN: Data::Dumper loaded ok (v2.124)
'YAML' not installed, falling back to Data::Dumper and Storable to read prefs '/root/.cpan/prefs'
Running make for R/RK/RKITOVER/Net-SSH2-0.53.tar.gz
CPAN: Digest::SHA loaded ok (v5.47)
CPAN: Compress::Zlib loaded ok (v2.02)
Checksum for /root/.cpan/sources/authors/id/R/RK/RKITOVER/Net-SSH2-0.53.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.52)
Net-SSH2-0.53/
Net-SSH2-0.53/.gitignore
Net-SSH2-0.53/BUILDING.WIN32
Net-SSH2-0.53/Changes
Net-SSH2-0.53/example/
Net-SSH2-0.53/fallback/
Net-SSH2-0.53/inc/
Net-SSH2-0.53/lib/
Net-SSH2-0.53/Makefile.PL
Net-SSH2-0.53/MANIFEST
Net-SSH2-0.53/MANIFEST.SKIP
Net-SSH2-0.53/META.yml
Net-SSH2-0.53/MYMETA.json
Net-SSH2-0.53/MYMETA.yml
Net-SSH2-0.53/ppport.h
Net-SSH2-0.53/README
Net-SSH2-0.53/SSH2.xs
Net-SSH2-0.53/t/
Net-SSH2-0.53/TODO
Net-SSH2-0.53/typemap
Net-SSH2-0.53/t/Net-SSH2.t
Net-SSH2-0.53/lib/Net/
Net-SSH2-0.53/lib/Net/SSH2/
Net-SSH2-0.53/lib/Net/SSH2.pm
Net-SSH2-0.53/lib/Net/SSH2/Channel.pm
Net-SSH2-0.53/lib/Net/SSH2/Dir.pm
Net-SSH2-0.53/lib/Net/SSH2/File.pm
Net-SSH2-0.53/lib/Net/SSH2/Listener.pm
Net-SSH2-0.53/lib/Net/SSH2/PublicKey.pm
Net-SSH2-0.53/lib/Net/SSH2/SFTP.pm
Net-SSH2-0.53/inc/Devel/
Net-SSH2-0.53/inc/Module/
Net-SSH2-0.53/inc/Module/Install/
Net-SSH2-0.53/inc/Module/Install.pm
Net-SSH2-0.53/inc/Module/Install/Base.pm
Net-SSH2-0.53/inc/Module/Install/Can.pm
Net-SSH2-0.53/inc/Module/Install/CheckLib.pm
Net-SSH2-0.53/inc/Module/Install/Fetch.pm
Net-SSH2-0.53/inc/Module/Install/Makefile.pm
Net-SSH2-0.53/inc/Module/Install/Metadata.pm
Net-SSH2-0.53/inc/Module/Install/Win32.pm
Net-SSH2-0.53/inc/Module/Install/WriteAll.pm
Net-SSH2-0.53/inc/Devel/CheckLib.pm
Net-SSH2-0.53/fallback/const-c.inc
Net-SSH2-0.53/fallback/const-xs.inc
Net-SSH2-0.53/example/read.pl
CPAN: File::Temp loaded ok (v0.22)
CPAN.pm: Going to build R/RK/RKITOVER/Net-SSH2-0.53.tar.gz
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.
Couldn't find your C compiler
Compilation failed in require at inc/Module/Install/CheckLib.pm line 17.
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
Warning (usually harmless): 'YAML' not installed, will not store persistent state
RKITOVER/Net-SSH2-0.53.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read '/root/.cpan/build/Net-SSH2-0.53-S94ijz/MYMETA.yml'. Falling back to other methods to determine prerequisites
答案1
正如你所说,你使用的是 Debian,最简单的方法是
aptitude install libnet-ssh2-perl
但是如果您确实希望从 CPAN 安装它,请确保您已经安装了所有开发工具和库以及 SSH 库:
aptitude install build-essential libssh2-1-dev
您可以从 CPAN 安装模块 - 只需通过上述步骤在最小的 Debian 安装上进行验证。