in reply to Re: Running remote commands (Net::SSH2)
in thread Running remote commands (Net::SSH2)

Hi and thanks for your response. Here's what I've got

> uname -a
Linux 2.4.21-37.ELsmp #1 SMP Wed Sep 7 13:28:55 EDT 2005 i686 i686 i386 GNU/Linux

1. Downloaded Net-SSH2-0.28 from CPAN (has dependencies on openssl and libssh
2. Downloaded and installed openssl-0.9.8l from http://www.openssl.org. All worked OK
3. Downloaded libssh2-1.2.2 from http://www.libssh2.org/
4. Untarred and then:

./configure --with-libssl-prefix=/usr/local/ssl (seemed to go through fine)
make

This is where it goes wrong. It runs through and exits with this:

/bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -o ssh2 ssh2.o ../../src/libssh2.la
libtool: link: gcc -g -O2 -o .libs/ssh2 ssh2.o ../../src/.libs/libssh2.so -L/usr/local/ssl/lib -lssl -lcrypto -lz -Wl,-rpath -Wl,/usr/local/lib
../../src/.libs/libssh2.so: undefined reference to `dlerror'
../../src/.libs/libssh2.so: undefined reference to `dlclose'
../../src/.libs/libssh2.so: undefined reference to `dlopen'
../../src/.libs/libssh2.so: undefined reference to `dlsym'
collect2: ld returned 1 exit status
make2: *** ssh2 Error 1
make2: Leaving directory `/tmp/libssh2-1.2.2/example/simple'
make1: *** all-recursive Error 1
make1: Leaving directory `/tmp/libssh2-1.2.2/example'
make: *** all-recursive Error 1
Any guidance greatly appreciated. John
  • Comment on Re^2: Running remote commands (Net::SSH2)

Replies are listed 'Best First'.
Re^3: Running remote commands (Net::SSH2)
by almut (Canon) on Dec 22, 2009 at 14:40 UTC
    /bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -o ssh2 ssh2 +.o ../../src/libssh2.la libtool: link: gcc -g -O2 -o .libs/ssh2 ssh2.o ../../src/.libs/libssh +2.so -L/usr/local/ssl/lib -lssl -lcrypto -lz -Wl,-rpath -Wl,/usr/loca +l/lib ../../src/.libs/libssh2.so: undefined reference to `dlerror' ../../src/.libs/libssh2.so: undefined reference to `dlclose' ../../src/.libs/libssh2.so: undefined reference to `dlopen' ../../src/.libs/libssh2.so: undefined reference to `dlsym'

    Looks like a problem with libdl not having been found during ./configure, so that the required -ldl is missing from the link command  (the dl library implements dlopen etc. which are used for run-time dynamic linking of shared libs).

    Maybe check

    • if you actually have the lib (would typically be in /lib or /lib64 or /usr/lib or /usr/lib64, e.g. /lib/libdl.so.2)
    • what the configure output has to say (--> "checking for dlopen ...", or some such)
    • if the link command succeeds if you manually issue it with -ldl added (from the directory where ssh2.o is), i.e.
      $ gcc -g -O2 -o .libs/ssh2 ssh2.o ../../src/.libs/libssh2.so -L/usr/l +ocal/ssl/lib -ldl -lssl -lcrypto -lz -Wl,-rpath -Wl,/usr/local/lib
Re^3: Running remote commands (Net::SSH2)
by Verillion (Initiate) on Dec 22, 2009 at 14:32 UTC
    From the output it looks like it's missing the -ldl flag, pulling in the dynamic linker lib. Could try that command with -ldl and see what you get. Looks like it should work after that to me.
      you mean on the ./configure part? tried that but it complained with

      error: unrecognized option: `-ldl'