www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Unable to link with OpenSSL libraries under Cygwin

Unable to link with OpenSSL libraries under Cygwin

From: Alex Rolfe <valistar.chii_at_gmail.com>
Date: Thu, 17 May 2012 22:29:46 -0400

Hello,

I'm having trouble building the library. I'm using libssh2-1.4.1 and
openssl-1.0.1c, and gcc v4.5.3 using Cygwin
I built the SSL library the other day, and it passed all its self-tests,
and links/runs fine with a basic test program.
When libssh2 tries to link with it, I get the following errors.

/bin/sh ../libtool --tag=CC --mode=link gcc -DLIBSSH2_WIN32 -o
libssh2.la -rpath /usr/local/ssh2/lib -version-info 1:1:0 -no-undefined
-export-symbols-regex '^libssh2_.*' -L/usr/local/ssl/lib -lssl
-L/usr/local/ssl/lib -lcrypto channel.lo comp.lo crypt.lo hostkey.lo
kex.lo mac.lo misc.lo packet.lo publickey.lo scp.lo session.lo sftp.lo
userauth.lo transport.lo version.lo knownhost.lo agent.lo openssl.lo
libgcrypt.lo pem.lo keepalive.lo global.lo

*** Warning: linker path does not have real file for library -lssl.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libssl and none of the candidates passed a file format test
*** using a file magic. Last file checked: /usr/local/ssl/lib/libssl.a

*** Warning: linker path does not have real file for library -lcrypto.
......
*** using a file magic. Last file checked: /usr/local/ssl/lib/libcrypto.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.

Shortly afterwards, the following errors appear. I'm only assuming this is
a result of the above linking failure.

libtool: link: gcc -DLIBSSH2_WIN32 -o .libs/direct_tcpip.exe
direct_tcpip.o ../src/.libs/libssh2.a -L/usr/local/ssl/lib -lssl -lcrypto
direct_tcpip.o:direct_tcpip.c:(.text+0xec): undefined reference to
`__imp__libssh2_init'
direct_tcpip.o:direct_tcpip.c:(.text+0x21f): undefined reference to
`__imp__libssh2_session_init_ex'
...

I defined /usr/local/ssl as the ssl prefix when I configured the makefile,
which is the correct location.. The part that confuses me is "Last file
checked: /usr/local/ssl/lib/libssl.a" It appears to be finding the real
file for the library just fine?
I'm not sure why -DLIBSSH2_WIN32 is defined with cygwin, but I don't
believe its the problem. I already fixed the make errors I was running in
to because of it, in misc.c. The other people on the mailing list with the
same define with cygwin weren't having the problem I'm having with linking.

When I try make without -no-undefined, I don't get the errors about not
being able to link with ssl and crypto, but I still get the later undefined
references.
I'd appreciate any information, I'm not sure what the problem is.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-05-18

the libssh2 team