1827439 Members
6566 Online
109965 Solutions
New Discussion

Re: Net::SSH Module

 
SOLVED
Go to solution
rashmi R
Advisor

Net::SSH Module

Hi:
Iam using Net::SSH::Perl module for remote login. This module was installed successfully.
when i try to run a sample script

#!/usr/bin/perl
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new($host,port=>22);
$ssh->login($user, $pass);

i get the following error
Can't locate Math/GMP.pm in @INC (@INC contains: /opt/perl_32/lib/5.8.7/PA-RISC1.1-thread-multi /opt/perl_32/lib/5.8.7 /opt/perl_32/lib/site_perl/5.8.7/PA-RISC1.1-thread-multi /opt/perl_32/lib/site_perl/5.8.7 /opt/perl_32/lib/site_perl /opt/perl_32/lib/vendor_perl/5.8.7/PA-RISC1.1-thread-multi /opt/perl_32/lib/vendor_perl/5.8.7 /opt/perl_32/lib/vendor_perl .) at /opt/perl_32/lib/site_perl/5.8.7/Net/SSH/Perl/Util/SSH1MP.pm line 7, line 1.
BEGIN failed--compilation aborted at /opt/perl_32/lib/site_perl/5.8.7/Net/SSH/Perl/Util/SSH1MP.pm line 7, line 1.
Compilation failed in require at /opt/perl_32/lib/site_perl/5.8.7/Net/SSH/Perl/Util.pm line 56, line 1.
BEGIN failed--compilation aborted at /opt/perl_32/lib/site_perl/5.8.7/Net/SSH/Perl/Key/RSA1.pm line 6, line 1.
Compilation failed in require at /opt/perl_32/lib/site_perl/5.8.7/Net/SSH/Perl/SSH1.pm line 13, line 1.
BEGIN failed--compilation aborted at /opt/perl_32/lib/site_perl/5.8.7/Net/SSH/Perl/SSH1.pm line 13, line 1.
Compilation failed in require at /opt/perl_32/lib/site_perl/5.8.7/Net/SSH/Perl.pm line 51, line 1.

when i try to install the Math::GMP from cpan where it tries to install math::GMP 2.04, it fails in >make. Does anyone which is the stable version of Math::GMP after 1.04 available on cpan or any other site

Thanks n Regards,
rashmi
21 REPLIES 21
Muthukumar_5
Honored Contributor

Re: Net::SSH Module

Try to search GMP.pm module in this location(s) as,

/opt/perl_32/lib/5.8.7/PA-RISC1.1-thread-multi /opt/perl_32/lib/5.8.7 /opt/perl_32/lib/site_perl/5.8.7/PA-RISC1.1-thread-multi /opt/perl_32/lib/site_perl/5.8.7 /opt/perl_32/lib/site_perl /opt/perl_32/lib/vendor_perl/5.8.7/PA-RISC1.1-thread-multi /opt/perl_32/lib/vendor_perl/5.8.7 /opt/perl_32/lib/vendor_perl

Else download the Math/GMP.pm and install to that location. Problem will be solved.

--
Muthu
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Net::SSH Module

Version 1.07 is there.

http://sources.redhat.com/ml/cygwin/2001-05/msg01343.html

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Net::SSH Module

Hi Rashmi,

Did you run Perl test after comipiling ? It should be helpful..

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
rashmi R
Advisor

Re: Net::SSH Module

Hi :
It fails in the installation itself. when i try to run Math::GMP
Rashmi
rashmi R
Advisor

Re: Net::SSH Module

Hi :
It fails in the installation itself. when i try to run Math::GMP

If i take only GMP.pm and complie it .. will it work
Rashmi
Arunvijai_4
Honored Contributor

Re: Net::SSH Module

Hi Rashmi,

Yes, installing GMP.pm module should be helpful. Try and let us know.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
rashmi R
Advisor

Re: Net::SSH Module

i got the MATH::GMP 1.07 from the site mentioned by muthu. but while trying to run the makefile it failed

$ cd Math-GMP-1.07
$ ls
COPYING.LIB GMP.pm LICENSE Makefile.PL gmp-2.0.2.tar.gz typemap
Changes GMP.xs MANIFEST README test.pl
$ perl Makefile.PL
sh: /gzip: not found.
Tar: blocksize = 0; broken pipe?
tar extraction of gmp-2.0.2.tar.gz failed at Makefile.PL line 11.
$ make
Make: No arguments or description file. Stop.
Arunvijai_4
Honored Contributor

Re: Net::SSH Module

$ cd Math-GMP-1.07
$ ls
COPYING.LIB GMP.pm LICENSE Makefile.PL gmp-2.0.2.tar.gz typemap
Changes GMP.xs MANIFEST README test.pl
$ perl Makefile.PL
sh: /gzip: not found.
Tar: blocksize = 0; broken pipe?
tar extraction of gmp-2.0.2.tar.gz failed at Makefile.PL line 11.
$ make
Make: No arguments or description file. Stop.

gzip is not available in your path.. also, make sure your download is not corrupted..

# where `which gzip`

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: Net::SSH Module

gzip is in /usr/contrib/bin/gzip location. Just try this:

export PATH=$PATH:/usr/contrib/bin

try again.

--
Muthu
Easy to suggest when don't know about the problem!
rashmi R
Advisor

Re: Net::SSH Module

HI Arun,
Well i have my gzip in path. coz when i try to install other modules i don't get errors. Only for this module i get this

Regards,
Rashmi
Muthukumar_5
Honored Contributor

Re: Net::SSH Module

Open Makefile.PL file. And search for gzip and change with full path name which you are getting in which gzip. Try to run make it again. Is it working.

--
Muthu


Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Net::SSH Module

Hi Rashmi,

Try to change the gzip path in Makefile.PL

# grep -i gzip Makefile.PL will list you. You can edit and make changes.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
rashmi R
Advisor

Re: Net::SSH Module

ys i went a step further now.
#perl Makefile.pl
succeeded
but # make install i got this errors

$ make install
cp GMP.pm blib/lib/Math/GMP.pm
AutoSplitting blib/lib/Math/GMP.pm (blib/lib/auto/Math/GMP)
/usr/bin/perl /opt/perl_32/lib/5.8.7/ExtUtils/xsubpp -typemap /opt/perl_32/lib/5.8.7/ExtUtils/typemap -typemap typemap GMP.xs > GMP.xsc && mv GMP.xsc GMP.c
Please specify prototyping behavior for GMP.xs (see perlxs manual)
cc -c -Igmp/include -D_POSIX_C_SOURCE=199506L -D_REENTRANT -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings +Z -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fast +Onolimit +Opromote_indirect_calls +DAportable +DS2.0 -DVERSION=\"1.07\" -DXS_VERSION=\"1.07\" +Z "-I/opt/perl_32/lib/5.8.7/PA-RISC1.1-thread-multi/CORE" GMP.c
(Bundled) cc: warning 480: The -A option is available only with the C/ANSI C product; ignored.
(Bundled) cc: warning 480: The +Z option is available only with the C/ANSI C product; ignored.
(Bundled) cc: warning 422: Unknown option "f" ignored.
(Bundled) cc: warning 480: The +Onolimit option is available only with the C/ANSI C product; ignored.
(Bundled) cc: warning 480: The +Opromote_indirect_calls option is available only with the C/ANSI C product; ignored.
(Bundled) cc: warning 480: The +Z option is available only with the C/ANSI C product; ignored.
cpp: "/opt/perl_32/lib/5.8.7/PA-RISC1.1-thread-multi/CORE/perlio.h", line 108: error 4065: Recursion in macro "PerlIO".
*** Error exit code 1

Stop.

which i had got when i was trying to install directly from cpan.

Thanks
Rashmi
Arunvijai_4
Honored Contributor

Re: Net::SSH Module

Hi Rashmi,

You dont have AnsiC compiler installed. Rather, you can use GCC to build this module.

# export CC=/usr/local/bin/gcc

then, # perl Makefile.PL

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
rashmi R
Advisor

Re: Net::SSH Module

#perl Makefile.pl
succeeded. but with warnings and errors. pl see the attached file

I think am getting same erros which i had got when i was trying to install directly from cpan.

Thanks
Rashmi
Arunvijai_4
Honored Contributor
Solution

Re: Net::SSH Module

Hi Rashmi,

Its again taking bundled C compiler make "CC=cc" "CFLAGS=-g -O" "XCFLAGS=" libmpn.a

You have to perform a # make clean and # make distclean before starting fresh..

Or, deleting that directory and untar/ungzip should help. (You have to start from fresh compilation since makefile is old and takes cc)

Also, dont forget to export gcc as your compiler.

-Arun

P.S Remember to assign points.
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: Net::SSH Module

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=890309

Refer this. Will solve problem.

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Net::SSH Module

Hi Rashmi,

Just check this,

# which perl
# perl -V

Try to use Procura's perl versions which can be downloaded from his site..

http://mirrors.develooper.com/hpux/


-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Pratyush Paul_1
Valued Contributor

Re: Net::SSH Module

Hi - there are 2 ways of doing this

1st way

#perl -MCPAN -e shell

cpan>install bundle

cpan>install SSH::Net

2nd Way

Download the source from Cpan.

#perl Makefile.PL
#gmake (make sure you use gcc)
#gmake test (make sure it passes all the test)
#gmake install

If you could post the output of the following

#ldd /usr/local/bin/perl
#perl -V

And then add a -w ( warning) at the very 1st line of your perl script and see what you get.

Thanks

Pratyush
Die Hard
overflow_1
New Member

Re: Net::SSH Module

hai sorri to interrupt this discussion, i have a problem here

how i can login to remote host and change it to super user with net::ssh?
or can u give me some sample script to do that

thanx a lot....
rashmi R
Advisor

Re: Net::SSH Module

Hi :
script to login
#!/usr/bin/perl
use Net::SSH::Perl;

$user='weblogic';
$pass='';
$host='hostname.hp.com';
print "before login \n";
my $ssh = Net::SSH::Perl->new($host,port=>22);
print "$user,$pass \n";
$ssh->login($user, $pass);
print "before cmd \n";
my($out, $err) = $ssh->cmd($cmd || "ls");
print "after login \n";
print $out;

$ssh->cmd("exit");