User Tools

Site Tools


c:build:build-libssh2-statically-on-windows-vs2017

This is an old revision of the document!


Prerequisites

  1. Download and install cmake
  2. Download the libssh2 sources and extract them (D:\libssh2)

Win32 static debug build with openssl and zlib support

cd D:\libssh2

mkdir out

cmake -DCMAKE_BUILD_TYPE=Debug -DOPENSSL_ROOT_DIR=D:/OpenSSL/out/debug -DOPENSSL_LIBRARIES=D:/OpenSSL/out/debug/lib OPENSSL_INCLUDE_DIR=D:/OpenSSL/out/debug/include -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./out -DCRYPTO_BACKEND=OpenSSL -DZLIB_LIBRARY:FILEPATH=D:/zlib/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=D:/zlib/include -DENABLE_ZLIB_COMPRESSION=ON ENABLE_DEBUG_LOGGING=ON -Wno-dev -DBUILD_TESTING=OFF --build . \\
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
-- Found ZLIB: D:/zlib/lib/zlib.lib (found version "1.2.11")
-- The following features have been enabled:

 * Compression, using zlib for compression
 * diffie-hellman-group-exchange-sha1, "new" diffie-hellman-group-exchange-sha1 method
 * Logging, Logging of execution with debug trace

-- The following REQUIRED packages have been found:

 * OpenSSL
 * ZLIB

-- The following features have been disabled:

 * Shared library, creating libssh2 as a shared library (.so/.dll)
 * "none" cipher
 * "none" MAC

-- Configuring done
-- Generating done
-- Build files have been written to: D:/libssh2
cmake --build . --target install
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  libssh2.vcxproj -> D:\libssh2\src\Debug\libssh2.lib
  example-direct_tcpip.vcxproj -> D:\libssh2\example\Debug\example-direct_tcpip.exe
  example-scp.vcxproj -> D:\libssh2\example\Debug\example-scp.exe
  example-scp_nonblock.vcxproj -> D:\libssh2\example\Debug\example-scp_nonblock.exe
  example-scp_write.vcxproj -> D:\libssh2\example\Debug\example-scp_write.exe
  example-scp_write_nonblock.vcxproj -> D:\libssh2\example\Debug\example-scp_write_nonblock.exe
  example-sftp.vcxproj -> D:\libssh2\example\Debug\example-sftp.exe
  example-sftp_RW_nonblock.vcxproj -> D:\libssh2\example\Debug\example-sftp_RW_nonblock.exe
  example-sftp_append.vcxproj -> D:\libssh2\example\Debug\example-sftp_append.exe
  example-sftp_mkdir.vcxproj -> D:\libssh2\example\Debug\example-sftp_mkdir.exe
  example-sftp_mkdir_nonblock.vcxproj -> D:\libssh2\example\Debug\example-sftp_mkdir_nonblock.exe
  example-sftp_nonblock.vcxproj -> D:\libssh2\example\Debug\example-sftp_nonblock.exe
  example-sftp_write.vcxproj -> D:\libssh2\example\Debug\example-sftp_write.exe
  example-sftp_write_nonblock.vcxproj -> D:\libssh2\example\Debug\example-sftp_write_nonblock.exe
  example-sftp_write_sliding.vcxproj -> D:\libssh2\example\Debug\example-sftp_write_sliding.exe
  example-sftpdir.vcxproj -> D:\libssh2\example\Debug\example-sftpdir.exe
  example-sftpdir_nonblock.vcxproj -> D:\libssh2\example\Debug\example-sftpdir_nonblock.exe
  example-ssh2.vcxproj -> D:\libssh2\example\Debug\example-ssh2.exe
  example-ssh2_agent.vcxproj -> D:\libssh2\example\Debug\example-ssh2_agent.exe
  example-ssh2_agent_forwarding.vcxproj -> D:\libssh2\example\Debug\example-ssh2_agent_forwarding.exe
  example-ssh2_echo.vcxproj -> D:\libssh2\example\Debug\example-ssh2_echo.exe
  example-ssh2_exec.vcxproj -> D:\libssh2\example\Debug\example-ssh2_exec.exe
  example-subsystem_netconf.vcxproj -> D:\libssh2\example\Debug\example-subsystem_netconf.exe
  example-tcpip-forward.vcxproj -> D:\libssh2\example\Debug\example-tcpip-forward.exe
  -- Install configuration: "Debug"
  -- Installing: D:/libssh2/out/share/doc/libssh2/AUTHORS
  -- Installing: D:/libssh2/out/share/doc/libssh2/COPYING
  -- Installing: D:/libssh2/out/share/doc/libssh2/HACKING
  -- Installing: D:/libssh2/out/share/doc/libssh2/README
  -- Installing: D:/libssh2/out/share/doc/libssh2/RELEASE-NOTES
  -- Installing: D:/libssh2/out/share/doc/libssh2/NEWS
  -- Installing: D:/libssh2/out/include/libssh2.h
  -- Installing: D:/libssh2/out/include/libssh2_publickey.h
  -- Installing: D:/libssh2/out/include/libssh2_sftp.h
  -- Installing: D:/libssh2/out/lib/libssh2.lib
  -- Installing: D:/libssh2/out/lib/cmake/libssh2/Libssh2Config.cmake
  -- Installing: D:/libssh2/out/lib/cmake/libssh2/Libssh2Config-debug.cmake
  -- Installing: D:/libssh2/out/lib/pkgconfig/libssh2.pc
  -- Installing: D:/libssh2/out/lib/cmake/libssh2/Libssh2ConfigVersion.cmake
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_connect.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_disconnect.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_free.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_get_identity.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_get_identity_path.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_init.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_list_identities.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_set_identity_path.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_agent_userauth.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_banner_set.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_base64_decode.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_close.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_direct_tcpip.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_direct_tcpip_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_eof.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_exec.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_flush.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_flush_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_flush_stderr.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_forward_accept.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_forward_cancel.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_forward_listen.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_forward_listen_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_free.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_get_exit_signal.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_get_exit_status.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_handle_extended_data.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_handle_extended_data2.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_ignore_extended_data.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_open_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_open_session.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_process_startup.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_read.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_read_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_read_stderr.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_receive_window_adjust.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_receive_window_adjust2.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_request_pty.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_request_pty_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_request_pty_size.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_request_pty_size_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_send_eof.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_set_blocking.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_setenv.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_setenv_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_shell.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_subsystem.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_wait_closed.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_wait_eof.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_window_read.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_window_read_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_window_write.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_window_write_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_write.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_write_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_write_stderr.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_x11_req.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_channel_x11_req_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_exit.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_free.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_hostkey_hash.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_init.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_keepalive_config.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_keepalive_send.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_add.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_addc.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_check.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_checkp.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_del.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_free.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_get.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_init.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_readfile.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_readline.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_writefile.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_knownhost_writeline.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_poll.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_poll_channel_read.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_add.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_add_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_init.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_list_fetch.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_list_free.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_remove.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_remove_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_publickey_shutdown.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_scp_recv.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_scp_recv2.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_scp_send.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_scp_send64.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_scp_send_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_abstract.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_banner_get.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_banner_set.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_block_directions.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_callback_set.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_disconnect.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_disconnect_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_flag.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_free.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_get_blocking.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_get_timeout.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_handshake.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_hostkey.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_init.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_init_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_last_errno.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_last_error.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_set_last_error.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_method_pref.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_methods.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_set_blocking.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_set_timeout.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_startup.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_session_supported_algs.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_close.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_close_handle.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_closedir.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_fsetstat.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_fstat.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_fstat_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_fstatvfs.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_fsync.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_get_channel.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_init.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_last_error.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_lstat.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_mkdir.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_mkdir_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_open.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_open_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_opendir.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_read.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_readdir.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_readdir_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_readlink.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_realpath.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_rename.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_rename_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_rewind.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_rmdir.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_rmdir_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_seek.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_seek64.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_setstat.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_shutdown.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_stat.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_stat_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_statvfs.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_symlink.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_symlink_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_tell.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_tell64.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_unlink.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_unlink_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_sftp_write.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_trace.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_trace_sethandler.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_authenticated.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_hostbased_fromfile.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_hostbased_fromfile_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_keyboard_interactive.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_keyboard_interactive_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_list.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_password.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_password_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_publickey.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_publickey_fromfile.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_publickey_fromfile_ex.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_userauth_publickey_frommemory.3
  -- Installing: D:/libssh2/out/share/man/man3/libssh2_version.3

Resulted file:

Win32 static release build with openssl and zlib support

cmake -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=D:/OpenSSL/out/release -DOPENSSL_LIBRARIES=D:/OpenSSL/out/release/lib OPENSSL_INCLUDE_DIR=D:/OpenSSL/out/release/include -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./out -DCRYPTO_BACKEND=OpenSSL -DZLIB_LIBRARY:FILEPATH=D:/zlib/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=D:/zlib/include -DENABLE_ZLIB_COMPRESSION=ON -Wno-dev -DBUILD_TESTING=OFF --build .
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
-- The following features have been enabled:

 * Compression, using zlib for compression
 * diffie-hellman-group-exchange-sha1, "new" diffie-hellman-group-exchange-sha1 method
 * Logging, Logging of execution with debug trace

-- The following REQUIRED packages have been found:

 * OpenSSL
 * ZLIB

-- The following features have been disabled:

 * Shared library, creating libssh2 as a shared library (.so/.dll)
 * "none" cipher
 * "none" MAC

-- Configuring done
-- Generating done
-- Build files have been written to: D:/libssh2
cmake --build . --target install
c/build/build-libssh2-statically-on-windows-vs2017.1593469464.txt.gz · Last modified: 2020/06/30 01:24 by odefta