I am trying to install Net:SSH2 Perl module, but I run in this error:
[root@script-server fmzbih_cms_weather_updater]# cpanm Net::SSH2
--> Working on Net::SSH2
Fetching http://www.cpan.org/authors/id/R/RK/RKITOVER/Net-SSH2-0.44.tar.gz ... OK
Configuring Net-SSH2-0.44 ... OK
Building and testing Net-SSH2-0.44 ... FAIL
! Installing Net::SSH2 failed. See /root/.cpanm/build.log for details.
[root@script-server fmzbih_cms_weather_updater]# cat /root/.cpanm/build.log
cpanm (App::cpanminus) 1.5011 on perl 5.014002 built for i686-linux-thread-multi
Work directory is /root/.cpanm/work/1335442976.25013
You have make /usr/bin/make
You have LWP 6.04
You have /bin/tar: tar (GNU tar) 1.15.1
You have /usr/bin/unzip
Searching Net::SSH2 on cpanmetadb ...
--> Working on Net::SSH2
Fetching http://www.cpan.org/authors/id/R/RK/RKITOVER/Net-SSH2-0.44.tar.gz
-> OK
Unpacking Net-SSH2-0.44.tar.gz
Entering Net-SSH2-0.44
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.59 ... Yes (6.62)
Configuring Net-SSH2-0.44
Running Makefile.PL
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.
Debian: sudo aptitude install libssh2-1-dev
OpenSUSE: sudo zypper in libssh2-1 libssh2-devel
You can pass your libssh2 lib and include dirs on the command line. E.g.:
perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include
If you want to build on Windows, see the file BUILDING.WIN32 in the
distribution.
Checking if your kit is complete...
Looks good
Writing Makefile for Net::SSH2
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 6.59 ... Yes (6.62)
Building and testing Net-SSH2-0.44
cp lib/Net/SSH2/File.pm blib/lib/Net/SSH2/File.pm
cp lib/Net/SSH2/Dir.pm blib/lib/Net/SSH2/Dir.pm
cp lib/Net/SSH2/PublicKey.pm blib/lib/Net/SSH2/PublicKey.pm
cp lib/Net/SSH2/SFTP.pm blib/lib/Net/SSH2/SFTP.pm
cp lib/Net/SSH2/Listener.pm blib/lib/Net/SSH2/Listener.pm
cp lib/Net/SSH2/Channel.pm blib/lib/Net/SSH2/Channel.pm
cp lib/Net/SSH2.pm blib/lib/Net/SSH2.pm
AutoSplitting blib/lib/Net/SSH2.pm (blib/lib/auto/Net/SSH2)
/usr/local/bin/perl "-Iinc" /usr/local/lib/perl5/5.14.2/ExtUtils/xsubpp -typemap /usr/local/lib/perl5/5.14.2/ExtUtils/typemap -typemap typemap SSH2.xs > SSH2.xsc && mv SSH2.xsc SSH2.c
cc -c -I/usr/local/include -I/usr/include -I. -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.44\" -DXS_VERSION=\"0.44\" -fPIC "-I/usr/local/lib/perl5/5.14.2/i686-linux-thread-multi/CORE" SSH2.c
Running Mkbootstrap for Net::SSH2 ()
chmod 644 SSH2.bs
rm -f blib/arch/auto/Net/SSH2/SSH2.so
LD_RUN_PATH="/usr/lib:/lib" cc -shared -O2 -L/usr/local/lib -fstack-protector SSH2.o -o blib/arch/auto/Net/SSH2/SSH2.so \
-L/root -L/usr/local/lib -L/lib -L/usr/lib -L/usr/local/lib -L/usr/local -L/usr/lib -L/usr -L/opt -L//lib -L/ -lssh2 -lz -lssl -lcrypto \
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Net/SSH2/SSH2.so] Error 1
-> FAIL Installing Net::SSH2 failed. See /root/.cpanm/build.log for details.
Seems like I am unable to compile something due to glibc static linking. However, I don't know what's alternative for glibc-static on CentOS 5.
Your system is missing the gzip library development files.
Try
yum install zlib-devel
... that should resolve your issue.
I do tend to use CPAN over the system package managers for perl modules, because CPAN will recursively download and build required dependencies.
cpan
man cpan