-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix finding and linking libssh2 #6602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? 8000 Sign in to your account
Conversation
Trying to use this PR, I'm getting:
and then the build fails with:
While building with:
It seems to ignore
|
@@ -14,13 +14,13 @@ function(FIND_PKGLIBRARIES prefix package) | |||
foreach(LIBRARY ${${prefix}_LIBRARIES}) | |||
find_library(${LIBRARY}_RESOLVED ${LIBRARY} PATHS ${${prefix}_LIBRARY_DIRS}) | |||
if(${${LIBRARY}_RESOLVED} STREQUAL "${LIBRARY}_RESOLVED-NOTFOUND") | |||
message(FATAL_ERROR "could not resolve ${LIBRARY}") | |||
message(WARNING "could not resolve ${LIBRARY}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my only question - why are we changing this from a fatal to a warning? What's the operational change that this makes? If - for example - I asked for libssh2 on the command line and we couldn't find it, that should be a hard fail, shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to explain this in the post above: on Windows we need to link some Windows SDK dlls such as ws2_32.lib. Cmake does not find these on the command line, so it fails, but the mingw-w64 linker can find them just fine.
See: https://cmake.org/pipermail/cmake/2010-July/037875.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps another solution would be to skip-list known windows sdk libraries.
This reverts the regression from #6586, and addresses the real issue.
On Windows, libssh2 depends on a few win32 system dlls such as
ws2_32
that we need to pass to the linker:# pkg-config --libs libssh2 -L/ucrt64/lib -lssh2 -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32
The linker understands this, but somehow the cmake check
find_library
does not find these windows dlls and fails:The change in #6586 masks the problem by not finding libssh2 at all anymore (by looking for the wrong lib name). This makes no sense, the
.pc
name islibssh2
and notssh2
, so we need to revert this.This address the underlying problem, perhaps we can just warn instead of fail if cmake is unable to validate one of the libs.
Reverts #6586. Fixes #5981 for real.
@Faless