I use 3 libraries, I connected all of them using vcpkg using static, compile in Release/MT, but I don't understand why 2 of them are created dynamically:
libcrypto-3-x64.dll
and ssh.dll
Through DependencyWalker, I saw that the .exe
file itself directly requires only ssh.dll
, and ssh.dll
requires libcrypto-3-x64.dll
.
There are no problems with jsoncpp.lib
.
I added them to the project accordingly:
"C:\Program Files\Microsoft Visual Studio\2022\vcpkg\packages\openssl_x64-windows-static\lib;C:\Program Files\Microsoft Visual Studio\2022\vcpkg\packages\libssh_x64-windows-static\lib;C:\Program Files\Microsoft Visual Studio\2022\vcpkg\packages\jsoncpp_x64-windows-static\lib"
I also added the corresponding libraries to the list of additional dependencies:
"$(CoreLibraryDependencies);%(AdditionalDependencies)Crypt32.lib;ws2_32.lib;ssh.lib;jsoncpp.lib;libcrypto.lib"
But, the thing is that libcrypto.lib
needs other Windows libraries, which I also include (without specifying the path to them):
Crypt32.lib;ws2_32.lib
Also I use similar include and pragma settings:
#include <Windows.h>
#include <wincrypt.h>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <openssl/evp.h>
#include <libssh/sftp.h>
#include <fcntl.h>
#pragma comment(lib, "Crypt32.lib")
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "jsoncpp.lib")
#pragma comment(lib, "libcrypto.lib")
#pragma comment(lib, "ssh.lib")
Maybe it's a matter of connecting .h
header files (openssl/evp.h
, libssh/sftp.h
, fcntl.h
) from libssh and openssl?
I understand that the problem is most likely in Crypt32.lib
and
ws2_32.lib
, but I'm new and don’t understand how to fix it. I couldn’t find a way on the Internet to connect these two libraries statically. Of course, I could spend time myself and find a solution, but I already spent all day understanding static compilation and therefore I ask for your help.
What can I add? The problem is only with ssh.lib
, there are no problems with libcrypto.lib
(checked). Most likely ssh.lib
cannot be made static, which is very sad. But if anyone has any ideas, I will be glad.
The thing turned out to be that OpenSSL includes two libraries: in addition to libcrypto.lib, there is also libssl.lib, which is used by ssh.lib. I added libssl.lib to the list of libraries and everything became normal