[Build issue] Link error when building using MSYS2 + MinGW64 toolchain + CMake
Hi, Building libssh using cmake + mingw64 results with link errors.
To fix this, I need to manually edit src/CMakeLists.txt
file and add link to ws2_32
Now, this library is already added to ${LIBSSH_LINK_LIBRARIES}
, but it should be added last
I am applying the following small patch in order to make it build:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4f350d9d..45b43a1f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -100,6 +100,13 @@ if (BUILD_STATIC_LIB)
)
endif (BUILD_STATIC_LIB)
+if (WIN32)
+ set(LIBSSH_LINK_LIBRARIES
+ ${LIBSSH_LINK_LIBRARIES}
+ ws2_32
+ )
+endif (WIN32)
+
set(libssh_SRCS
agent.c
auth.c
It would be great if you could fix this :) FYI: In the meantime, I provided my users this build instructions: https://docs.codelite.org/build/mingw_builds/#building-libssh
Edited by Eran Ifrah