Error installing Net::SSH2

Error installing Net::SSH2

am 08.02.2007 16:48:38 von csb

Installing via cpan. Everything looks fine until it attempts to make
test.
- - - - - -
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Net-SSH2....
t/Net-SSH2....NOK 1/72# Failed test 'use
Net::SSH2;'
# at t/Net-SSH2.t line 19.
# Tried to use 'Net::SSH2'.
# Error: Can't load '/.cpan/build/Net-SSH2-0.09/blib/arch/auto/
Net/SSH2/SSH2.so' for module Net::SSH2: ld.so.1: perl: fatal:
relocation error: file /usr/local/lib/libssh2.so: symbol
EVP_aes_192_cbc: referenced symbol not found at /usr/local/lib/
perl5/5.8.7/sun4-solaris/DynaLoader.pm line 230.
# at (eval 3) line 2
- - - - - -

Usually, I can decipher some clue as to why a module isn't installing
and go hunting for an answer. However, i can't seem to figure out
which way to go on this one.

If you have any suggestions, they would be greatly appreciated.

Thanks!

- - Additional Info - -
SunOS 5.10 sparc
OpenSSL 0.9.7d 17 Mar 2004
Perl v5.8.7
libssh2-0.14


cpan[2]> install
Net::SSH2
Running install for module Net::SSH2
Running make for D/DB/DBROBINS/Net-SSH2-0.09.tar.gz
CPAN: Digest::SHA loaded ok
CPAN: Compress::Zlib loaded ok
Checksum for /.cpan/sources/authors/id/D/DB/DBROBINS/Net-
SSH2-0.09.tar.gz ok
Scanning cache /.cpan/build for sizes
x Net-SSH2-0.09, 0 bytes, 0 tape blocks
x Net-SSH2-0.09/META.yml, 411 bytes, 1 tape blocks
x Net-SSH2-0.09/t, 0 bytes, 0 tape blocks
x Net-SSH2-0.09/t/Net-SSH2.t, 6700 bytes, 14 tape blocks
x Net-SSH2-0.09/SSH2.xs, 49979 bytes, 98 tape blocks
x Net-SSH2-0.09/README, 2780 bytes, 6 tape blocks
x Net-SSH2-0.09/example, 0 bytes, 0 tape blocks
x Net-SSH2-0.09/example/read.pl, 1013 bytes, 2 tape blocks
x Net-SSH2-0.09/MANIFEST, 339 bytes, 1 tape blocks
x Net-SSH2-0.09/typemap, 2876 bytes, 6 tape blocks
x Net-SSH2-0.09/ppport.h, 117049 bytes, 229 tape blocks
x Net-SSH2-0.09/fallback, 0 bytes, 0 tape blocks
x Net-SSH2-0.09/fallback/const-c.inc, 59661 bytes, 117 tape blocks
x Net-SSH2-0.09/fallback/const-xs.inc, 2651 bytes, 6 tape blocks
x Net-SSH2-0.09/Changes, 3013 bytes, 6 tape blocks
x Net-SSH2-0.09/Makefile.PL, 6833 bytes, 14 tape blocks
x Net-SSH2-0.09/lib, 0 bytes, 0 tape blocks
x Net-SSH2-0.09/lib/Net, 0 bytes, 0 tape blocks
x Net-SSH2-0.09/lib/Net/SSH2, 0 bytes, 0 tape blocks
x Net-SSH2-0.09/lib/Net/SSH2/Dir.pm, 828 bytes, 2 tape blocks
x Net-SSH2-0.09/lib/Net/SSH2/Listener.pm, 815 bytes, 2 tape blocks
x Net-SSH2-0.09/lib/Net/SSH2/SFTP.pm, 2322 bytes, 5 tape blocks
x Net-SSH2-0.09/lib/Net/SSH2/Channel.pm, 4513 bytes, 9 tape blocks
x Net-SSH2-0.09/lib/Net/SSH2/File.pm, 2117 bytes, 5 tape blocks
x Net-SSH2-0.09/lib/Net/SSH2.pm, 22476 bytes, 44 tape blocks
Removing previously used /.cpan/build/Net-SSH2-0.09

CPAN.pm: Going to build D/DB/DBROBINS/Net-SSH2-0.09.tar.gz

Net::SSH2: using library -L/usr/local/lib -lssh2 and include path -I/
usr/local/include.
Checking if your kit is complete...
Looks good
Writing Makefile for Net::SSH2
CPAN: YAML loaded ok
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/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/bin/perl /usr/local/lib/perl5/5.8.7/ExtUtils/xsubpp -typemap /
usr/local/lib/perl5/5.8.7/ExtUtils/typemap -typemap typemap SSH2.xs >
SSH2.xsc && mv SSH2.xsc SSH2.c
gcc -B/usr/ccs/bin/ -c -I/usr/local/include -I. -fno-strict-aliasing -
pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -
O -DVERSION=\"0.09\" -DXS_VERSION=\"0.09\" -fPIC "-I/usr/local/lib/
perl5/5.8.7/sun4-solaris/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/local/lib" gcc -B/usr/ccs/bin/ -G -L/usr/local/lib
SSH2.o -o blib/arch/auto/Net/SSH2/SSH2.so -L/usr/local/lib -
lssh2
chmod 755 blib/arch/auto/Net/SSH2/SSH2.so
cp SSH2.bs blib/arch/auto/Net/SSH2/SSH2.bs
chmod 644 blib/arch/auto/Net/SSH2/SSH2.bs
Manifying blib/man3/Net::SSH2::File.3
Manifying blib/man3/Net::SSH2::Dir.3
Manifying blib/man3/Net::SSH2::SFTP.3
Manifying blib/man3/Net::SSH2::Listener.3
Manifying blib/man3/Net::SSH2::Channel.3
Manifying blib/man3/Net::SSH2.3
/usr/local/bin/gmake -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Net-SSH2....
t/Net-SSH2....NOK 1/72# Failed test 'use
Net::SSH2;'
# at t/Net-SSH2.t line 19.
# Tried to use 'Net::SSH2'.
# Error: Can't load '/.cpan/build/Net-SSH2-0.09/blib/arch/auto/
Net/SSH2/SSH2.so' for module Net::SSH2: ld.so.1: perl: fatal:
relocation error: file /usr/local/lib/libssh2.so: symbol
EVP_aes_192_cbc: referenced symbol not found at /usr/local/lib/
perl5/5.8.7/sun4-solaris/DynaLoader.pm line 230.
# at (eval 3) line 2
# Compilation failed in require at (eval 3) line 2.
# BEGIN failed--compilation aborted at t/Net-SSH2.t line 19.
&Net::SSH2::constant not defined at t/Net-SSH2.t line 22
# Looks like you planned 72 tests but only ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test died just after 1.
t/Net-
SSH2....dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-72
Failed 72/72 tests, 0.00% okay
Failed Test Stat Wstat Total Fail List of Failed
------------------------------------------------------------ -------------------
t/Net-SSH2.t 255 65280 72 143 1-72
Failed 1/1 test scripts. 72/72 subtests failed.
Files=1, Tests=72, 1 wallclock secs ( 0.17 cusr + 0.04 csys = 0.21
CPU)
Failed 1/1 test programs. 72/72 subtests failed.
gmake: *** [test_dynamic] Error 255
/usr/local/bin/gmake test -- NOT OK
Running make install
make test had returned bad status, won't install without force
Failed during this command:
DBROBINS/Net-SSH2-0.09.tar.gz : make_test NO

cpan[3]>

Re: Error installing Net::SSH2

am 09.02.2007 03:16:19 von Sisyphus

"CsB" wrote in message
news:1170949718.358244.53420@j27g2000cwj.googlegroups.com...
..
..
> # Error: Can't load '/.cpan/build/Net-SSH2-0.09/blib/arch/auto/
> Net/SSH2/SSH2.so' for module Net::SSH2: ld.so.1: perl: fatal:
> relocation error: file /usr/local/lib/libssh2.so: symbol
> EVP_aes_192_cbc: referenced symbol not found at /usr/local/lib/
> perl5/5.8.7/sun4-solaris/DynaLoader.pm line 230.
> # at (eval 3) line 2
> - - - - - -
>
> Usually, I can decipher some clue as to why a module isn't installing
> and go hunting for an answer. However, i can't seem to figure out
> which way to go on this one.
>
> If you have any suggestions, they would be greatly appreciated.
>

Only place I can find any mention of 'EVP_aes_192_cbc' is in (the openssl
header file) evp.h. And then it's only mentioned once .... which seems a bit
strange to me.

I don't know if that piece of information will help you at all.

Net::SSH2 built ok for me on Win32 - requiring only a few simple hacks. I
certainly didn't strike any problems involving 'EVP_aes_192_cbc'.

I built static libs (openssl, libssh2). I guess that's one thing you could
also try if you get really stuck.

Have you done any testing (ie using C programs) of the libssh2 library to
verify that it's functioning properly ?

Cheers,
Rob

Re: Error installing Net::SSH2

am 12.02.2007 16:41:53 von csb

On Feb 8, 8:16 pm, "Sisyphus" wrote:
>
> I built static libs (openssl,libssh2). I guess that's one thing you could
> also try if you get really stuck.
>
> Have you done any testing (ie using C programs) of thelibssh2library to
> verify that it's functioning properly ?
>

I'm not familiar with static libs. Could you provide a bit more
detail? I'm interested in doing whatever it takes to get Net::SSH2
installed and functioning.

I haven't done any testing (I don't know C). But, I'd like to know
more about how I could test libssh2 to ensure it's installed properly.

Thank you for your response. Advice is always appreciated.

Re: Error installing Net::SSH2

am 13.02.2007 12:25:12 von Sisyphus

"CsB" wrote in message
news:1171294913.591870.276040@q2g2000cwa.googlegroups.com...
> On Feb 8, 8:16 pm, "Sisyphus" wrote:
>>
>> I built static libs (openssl,libssh2). I guess that's one thing you could
>> also try if you get really stuck.
>>
>> Have you done any testing (ie using C programs) of thelibssh2library to
>> verify that it's functioning properly ?
>>
>
> I'm not familiar with static libs. Could you provide a bit more
> detail?

Generally run './configure --help' to find the available options.

For openssl:
../config no-shared
make
make check
make install

IIRC libssh2 insists on building a shared library. So I had to build the
static library from the object files that were built in the 'src' folder -
ie cd to the 'src' folder and run:

ar rc libssh2.a channel.o comp.o crypt.o hostkey.o kex.o mac.o misc.o
packet.o publickey.o scp.o session.o sftp.o userauth.o
/c/_32/msys/1.0/local/ssl/lib/libssl.a
/c/_32/msys/1.0/local/ssl/lib/libcrypto.a /c/_32/msys/1.0/local/lib/libz.a
/c/_32/MinGW/lib/libws2_32.a /c/_32/MinGW/lib/libgdi32.a

Then 'ranlib libssh2.a' and copy it to the appropriate location.
(I also have a static build of libz.)

> I'm interested in doing whatever it takes to get Net::SSH2
> installed and functioning.

Of course, it shouldn't be necessary to use static libs. And you may still
find the same (or similar) problem anyway. It's just something you could try
if your stuck .... and if you think it's worth the effort :-)

>
> I haven't done any testing (I don't know C). But, I'd like to know
> more about how I could test libssh2 to ensure it's installed properly.
>

The only C example I have is one that uses Windows-specific stuff to make
the connection - so you'd have to change that part of the code if you're not
on Windows. It's just something put together to verify that the C side of
things is basically functional (as far as it goes).

///// ssh2 .c /////
#include
#include
//#include
#include
#include
#include
#include "F:/libssh2-0.14/win32/libssh2_config.h"

int main() {

LIBSSH2_SESSION * sess_ptr;
LIBSSH2_CHANNEL * chann_ptr;
char * buf;
int ret, read, buflen = 100;

buf = malloc(buflen * sizeof(char));

printf("BANNER: %s\n", LIBSSH2_SSH_BANNER);

////////////////////////////////////////////////
SOCKET lhSocket;
SOCKADDR_IN lSockAddr;
WSADATA wsaData;
int lConnect;
int lLength;
///////////////////////////////////////////////

if(WSAStartup(MAKEWORD(2,0),&wsaData) != 0) {
printf("Socket Initialization Error. Program aborted\n");
return 0;
}

lhSocket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(lhSocket == INVALID_SOCKET) printf("Invalid Socket %s. Program
Aborted\n", GetLastError());
memset(&lSockAddr,0, sizeof(lSockAddr));
lSockAddr.sin_family = AF_INET;
lSockAddr.sin_port = htons(22);
lSockAddr.sin_addr.s_addr = inet_addr("192.168.0.3"); // linux box that
houses the SSH2 server
lConnect = connect(lhSocket,(SOCKADDR *)&lSockAddr,sizeof(SOCKADDR_IN));
if(lConnect != 0) {
printf("Connect Error. Program aborted\n");
return 0;
}

printf("SOCKET: %d\n", lhSocket);

sess_ptr = libssh2_session_init_ex(NULL, NULL, NULL, NULL);

ret = libssh2_session_startup(sess_ptr, lhSocket);
if(ret == 0) printf("1: Success\n");
else {
if(ret == -1) printf("1: Failure\n");
else printf("libssh2_session_startup returned an undocumented value:
%d. Documented values are 0 and -1\n", ret);
}

ret = libssh2_userauth_password(sess_ptr, "username", "password");

if(ret == 0) printf("2: Success\n");
else {
if(ret == -1) printf("2: Failure\n");
else printf("libssh2_userauth_password returned an undocumented value:
%d. Documented values are 0 and -1\n", ret);
}

chann_ptr = libssh2_channel_open_session(sess_ptr);

if(chann_ptr == NULL) printf("3: Failure\n");
else printf("3: Success\n");

libssh2_channel_set_blocking(chann_ptr, 1);

ret = libssh2_channel_exec(chann_ptr, "rm -f
/home/rob/Documents/F77.pm");
// ret = libssh2_channel_process_startup(chann_ptr, "exec", 4, "ls -d /",
7); // also works

read = libssh2_channel_read(chann_ptr, buf, buflen);

printf("RET: %d BUF: %s #\n", read, buf);

if(ret == 0) printf("4: Success\n");
else {
if(ret == -1) printf("4: Failure\n");
else printf("libssh2_channel_exec returned an undocumented value: %d.
Documented values are 0 and -1\n", ret);
}

free(buf);

printf("OK\n");
return 0;
}

//Build with: gcc -o ssh2.exe -ID:\MSYS\local\include
sh2.c -LD:\MSYS\local\lib -lssh2 -LF:\openssl\openssl-0.9.8d\lib -lssl -lcrypto
-LD:\MSYS\local\lib -lz -lws2_32 -lgdi32

Cheers,
Rob