c++ - 在 Windows 上编译 libssh2

标签 c++ ssh cmake libssh2

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

我从 github 下载 libssh2 并运行 cmake libssh2 然后 cmake -P cmake_install.cmake 但找不到安装文件“libssh2.lib”。

我被困在这里了!

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

缺少 Crypto_backend,我尝试使用 openssl 进行编译并得到很多未解析的符号。

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

好的!我使用了 cmake-gui 并删除了未解析的符号,但现在我遇到了一些头文件的问题。未定义 libssh2 var 类型。某种包括丢失的....?

最佳答案

我可以在 Windows 10 环境中编译 libssh2(我很感兴趣)。

环境:

  • Windows 10 x64。
  • Visual Studio Community 2017 版本 15.2 (26430.4) 发布。
  • CMake 版本 3.9.0-rc5(我必须卸载以前的 在安装最后一个版本之前手动版本,因为安装程序有 已更改,正如 cmake 网络建议的那样)。
  • Git 版本 2.10.1.windows.1

如果您请求除 WinCNG 之外的任何其他加密后端库,恐怕您需要在尝试编译 libssh2 之前先编译该加密后端库,并确保 CMake 自动找到加密后端库(如果没有,请检查请求 cmake 变量并手动完成)。

在cmd中使用WinCNG和动态库选项编译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 目录中。

希望这个迷你指南能帮到你。

关于c++ - 在 Windows 上编译 libssh2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44889540/

相关文章:

c++ - 试图删除一个空对象的断言

php - 在 SSH2 上通过 root 运行命令

ssh - 将 Visual Studio Code 连接到 Codeanywhere 容器

c++ - 如何在没有 cmake 文件的情况下使用 jhbuild 构建 OpenFace 库?

c++ - 在框架上绘制矩形

c++ - 如何在 C++ 中初始化静态指针?

c++ - 更新 std::map 中键的值

regex - Fail2ban 规则不起作用

c++ - 如何使用 CMake 配置 DBus 依赖项

gcc - 在不同目录中使用已编译文件的绝对路径时,如何进行ccache缓存编译?