在Windows上编译libssh2 [英] Compiling libssh2 on windows

查看:504
本文介绍了在Windows上编译libssh2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我使用Visual Studio 2017在Windows上编译libssh2. 我发现的唯一的东西太旧和过时了.

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

我从github下载了libssh2,先运行cmake libssh2,然后运行cmake -P cmake_install.cmake,但找不到安装文件"libssh2.lib".

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

我被困在这里!

********更新1 ***********

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

Crypto_backend丢失了,我试图用openssl编译并得到很多未解析的符号.

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

********更新2 ***********

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

好!我使用了cmake-gui并摆脱了未解决的符号,但是现在我遇到了一些头文件的问题.未定义libssh2 var类型.某种包含缺失的东西...?

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....?

推荐答案

我可以在Windows 10环境中编译libssh2(引起了我的兴趣).

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

环境:

  • Windows 10 x64.
  • Visual Studio Community 2017版本15.2(26430.4) 释放.
  • CMake版本3.9.0-rc5(我必须卸载以前的版本 在安装最新版本之前,请先手动安装该版本,因为安装程序具有 发生变化,如cmake网站所建议的那样.)
  • Git版本2.10.1.windows.1
  • 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

如果您请求WinCNG以外的任何其他加密后端库,恐怕您需要先编译该加密后端库,然后再尝试编译libssh2并确保CMake自动找到加密后端库(如果没有,请检查请求的cmake变量并手动执行).

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).

使用WinCNG和动态库选项进入cmd编译libssh2 :

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

然后等不到一分钟,就会创建libssh并将其安装在dll目录中.

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

我希望这个迷你指南对您有所帮助.

I hope that this miniguide could help you.

这篇关于在Windows上编译libssh2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆