Subject: Re: Want to build monolithic libssh2.dll on Windows (preferably Win32 and Win64) but no real success so far

Re: Want to build monolithic libssh2.dll on Windows (preferably Win32 and Win64) but no real success so far

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Sat, 5 Nov 2016 23:05:30 +0000

On 3 November 2016 at 23:36, Jeroen Wiert Pluimers
<jeroen.pluimers.com+libssh2.org_at_gmail.com> wrote:
>
>
> On Thu, Nov 3, 2016 at 7:14 PM, Alexander Lamaison <swish_at_lammy.co.uk>
> wrote:
>>
>>
>> On Thu, 3 Nov 2016, 16:09 Jeroen Wiert Pluimers,
>> <jeroen.pluimers.com+libssh2.org_at_gmail.com> wrote:
>>>
>>>
>>> The slprobweb downloads contain static libs and are in fact recommended
>>> at the top of the list https://wiki.openssl.org/index.php/Binaries
>>
>>
>> But when you built libssh2 for OpenSSL and passed
>> OPENSSL_USE_STATIC_LIBS=ON to CMake, it still linked dynamically? If so that
>> is either a bug in CMake's FindOpenSSL.cmake, or the static libs in slproweb
>> are not for Visual Studio 2015.
>
>
> Below are the lib files; the lib\VC\static ones are the ones I want to use.
> I'll give it one more shot before the EKON conference and when it fails I
> will either go the hunter way or help Bert with
> https://github.com/Microsoft/vcpkg
>
> CMake finds the libraries but doesn't tell which one it uses:
> -- Found OpenSSL:
> optimized;C:/OpenSSL-Win64/lib/ssleay32.lib;debug;C:/OpenSSL-Win64/lib/VC/static/ssleay32MTd.lib;optimized;C:/OpenSSL-Win64/lib/libeay32.lib;debug;C:/OpenSSL-Win64/lib/VC/static/libeay32MTd.lib
> (found version "1.0.2j")
> -- Found OpenSSL:
> optimized;C:/OpenSSL-Win32/lib/ssleay32.lib;debug;C:/OpenSSL-Win32/lib/VC/static/ssleay32MTd.lib;optimized;C:/OpenSSL-Win32/lib/libeay32.lib;debug;C:/OpenSSL-Win32/lib/VC/static/libeay32MTd.lib
> (found version "1.0.2j")
>
> The odd thing is that CMake - despite specifying Release - seems to pick the
> Debug static libraries (*MTd.lib)

When you say it seems to pick the debug static libraries, are you
basing that on the lines you pasted above? Because that's not what
they mean.

When you configure a CMake project for Visual Studio, it generates a
project file that can build both debug and release (you can toggle
with the dropdown thingie) so when CMake looks for libraries for
visual studio, it looks for both kinds. Essentially CMAKE_BUILD_TYPE
is ignored.

Now what _is_ interesting from the lines above is that you are getting
static libraries for debug builds but dynamic libraries for release
builds! I don't know what could cause that. Though I've just spotted
a change in CMake 3.6 that might cause it [1]. Could you try with
CMake 3.5.2 or older?

If that doesn't work, did you perhaps configure it before in this
directory some time previously? I suggest starting with a completely
clean build directory.

[1]: https://gitlab.kitware.com/cmake/cmake/commit/b148440381df0143a665b7ceebe8606a052e2cdf

-- 
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-11-06