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

Archive Index This month's Index

Subject: Re: [1.7.0] Cannot build statically on Windows

Re: [1.7.0] Cannot build statically on Windows

From: Peter Stuge <peter_at_stuge.se>
Date: Thu, 25 Feb 2016 09:06:53 +0000

sisyphus1_at_optusnet.com.au wrote:
> On Windows, doing a static build of libssh2 (against static openssl
> and static libz) used to be a fairly simple task.

Why not build libssh2 against WinCNG instead of OpenSSL?

> With 1.7.0, the first build in "example" aborts with:
> C:/_32/msys_492/1.0/local/lib/libcrypto.a(e_capi.o):e_capi.c:(.text+0x20f):
> undefined reference to `_imp__CertFreeCertificateContext_at_4'

So the above says that C:/_32/msys_492/1.0/local/lib/libcrypto.a
(part of OpenSSL) is looking for an import library symbol for the
CertFreeCertificateContext function.

Import libraries look like static libraries (filenames end with .a or
.lib) but they are much smaller in size than the actual library file,
because they do not contain the code. They just contain a little bit
of code to load the actual shared library (DLL) at runtime.

At least with MSVC, this is how shared libraries are linked.

> So I'm quite nonplussed as to what accounts for the 1.7.0 failure.

I'm unclear why 1.6 is any different, but oh well.

> It seems *very* odd that the "src" build is working fine (including
> the creation of the static libssh2.a), yet the building of the first
> "example" program wants to find *dynamic* symbols.

This actually makes a lot of sense. The error happens when a program
is trying to link against libssh2, not when libssh2 itself is built.

libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-02-25

the libssh2 team