Subject: Re: compiling problem when installing libssh2-1.2.6

Re: compiling problem when installing libssh2-1.2.6

From: Peter Stuge <>
Date: Thu, 24 Jun 2010 10:33:45 +0200

Hi Xiaolei,

CHEN Xiaolei A wrote:
> I got a "ld" problem when installing libssh2-1.2.6.
> Backgroud:

Thanks for giving good information!

> (1) system version: Solaris 10 3/05 s10_74L2a SPARC
> (2) "Make" I used: /usr/ccs/bin/make
> (3) "gcc" I used: /usr/sfw/bin/gcc
> (4) "ld" I used: /usr/ccs/bin/ld
> (5) openssl already installed: openssl-0.9.8o (libssl.a and libcrypt.a aready exist)

Note that libssl.a and libcrypto.a are the static libraries for
OpenSSL. Did OpenSSL install also shared libraries (.so)?

> (6) my configuration to make libssh2: ./configuration --prefix=SOME_WHERE --with-openssl --with-libssl-prefix=MY_OPENSSL_DIRECTORY

It would be helpful if you could send config.log produced by

> libtool: link: gcc -shared -Wl,-z -Wl,text -Wl,-M -Wl,.libs/ -Wl,-h -Wl, -o .libs/ .libs/channel.o .libs/comp.o .libs/crypt.o .libs/hostkey.o .libs/kex.o .libs/mac.o .libs/misc.o .libs/packet.o .libs/publickey.o .libs/scp.o .libs/session.o .libs/sftp.o .libs/userauth.o .libs/transport.o .libs/version.o .libs/knownhost.o .libs/agent.o .libs/openssl.o .libs/libgcrypt.o .libs/pem.o .libs/keepalive.o .libs/global.o -L/home/xiaolech/work/openssl/lib -lssl -lcrypto -lz -lnsl -lsocket -lc
> Text relocation remains referenced
> against symbol offset in file
> <unknown> 0x0 /home/xiaolech/work/openssl/lib/libcrypto.a(err_def.o)
> Many error occured when linking libcrypt.a, how could I solve
> this problem? Thanks a lot.

I believe the problem is related to static vs. shared libraries. The
link command above shows libssh2 trying to be built as shared library
and libcrypto.a suggests that OpenSSL is being linked statically. I
think this should theoretically work, but I think the normal case is
for libssh2 to link with the shared libraries from OpenSSL.

You could try to build libssh2 completely statically by adding


to the ./configure command for libssh2. It might link successfully
but then you will of course only get a static libssh2 library. If you
would like to build libssh2 as shared library I would recommend to
first ensuring that OpenSSL has installed shared libraries also.

Received on 2010-06-24