Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling libssh2 on windows

Some one can help me to compile libssh2 on windows with Visual Studio 2017. The only things I found are too old and outdated.

I downloaded libssh2 from github and run cmake libssh2 and then cmake -P cmake_install.cmake but can't find INSTALL file "libssh2.lib".

And I'm stuck here!

******** Update 1 ***********

Crypto_backend is missing, I trying to compile with openssl and get a lot of unresolved symbols.

******** Update 2 ***********

Ok! I used the cmake-gui and get rid of the unresolved symbols but now I'm having issues with some header files. libssh2 var types are not defined. Some kind of include missing....?

like image 702
Samega 7Cattac Avatar asked Jul 03 '17 15:07

Samega 7Cattac


1 Answers

I could compile libssh2 in a Windows 10 environment (I was intrigued).

Environment:

  • Windows 10 x64.
  • Visual Studio Community 2017 version 15.2 (26430.4) Release.
  • CMake version 3.9.0-rc5 ( I had to uninstall a previous version manually before install the last version because the installer has changed, as the cmake web suggests).
  • Git version 2.10.1.windows.1

If you request any other crypto backend libraries than WinCNG , I am afraid you need to compile previously that crypto backend library before any attempt to compile libssh2 and make sure CMake find automatically the crypto-backend-library (if not, check for requested cmake variables and fulfill manually).

Steps in cmd to compile libssh2 using WinCNG and dynamic library option:

cd where/you/like/to/install
git clone https://github.com/libssh2/libssh2.git
cd libssh2
mkdir dll <-- directory to install libssh2
cmake -DCRYPTO_BACKEND=WinCNG -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./dll --build .
cmake --build . --target install

And et voilà, after less than a minute, libssh is created and installed in dll directory.

I hope that this miniguide could help you.

like image 158
JTejedor Avatar answered Nov 10 '22 11:11

JTejedor