Skip to content

Conversation

Faless
Copy link
Contributor

@Faless Faless commented Jun 25, 2023

Fixes "CMake Error: could not resolve ssh2" on Windows-MSVC.

Fixes #5981

Fixes "CMake Error: could not resolve ssh2" on Windows-MSVC.
@ethomson ethomson merged commit 72b5c53 into libgit2:main Jul 14, 2023
@ethomson
Copy link
Member

Thanks!

@ethomson ethomson added the build label Jul 15, 2023
@jeroen
Copy link
Contributor

jeroen commented Jul 19, 2023

This has created the converse problem for me on msys2:

-- Performing Test IS_WNO_UNUSED_FUNCTION_SUPPORTED
-- Performing Test IS_WNO_UNUSED_FUNCTION_SUPPORTED - Success
-- Performing Test IS_WNO_IMPLICIT_FALLTHROUGH_SUPPORTED
-- Performing Test IS_WNO_IMPLICIT_FALLTHROUGH_SUPPORTED - Success
-- Checking for module 'ssh2'
--   No package 'ssh2' found

@Faless
Copy link
Contributor Author

Faless commented Jul 19, 2023

@jeroen which OS are you on? Which cmake version?

I had tested this on Windows/Linux/macOS and it was working :( . Though it was using the static library on Linux (not the system shared one).

Did reverting the change fix the problem for you?

@jeroen
Copy link
Contributor

jeroen commented Jul 19, 2023

This is an msys2 based build on Windows, but as far as I can tell, the pkg-config file is called libssh2 on all platforms?

For example on mac:

pkg-config --libs ssh2
# Package ssh2 was not found in the pkg-config search path.
# Perhaps you should add the directory containing `ssh2.pc'
# to the PKG_CONFIG_PATH environment variable
# No package 'ssh2' found

pkg-config --libs libssh2
# -L/usr/local/Cellar/libssh2/1.11.0_1/lib -L/usr/local/opt/openssl@3/lib -lssh2 -lssl -lcrypto -R/usr/local/opt/openssl@3/lib

The problem will go unnoticed on most platforms because cmake can guess libssh2.so but in my platform this does not work because the static libssh2.a needs additional linker flags.

Reverting this PR indeed fixes my issue.

@Faless
Copy link
Contributor Author

Faless commented Jul 19, 2023

Well, it didn't work on Windows+MSVC (see the linked issue above).

But I guess this should be reverted then, and the issue re-opened?

Will need someone with better CMake knowledge then me to fix :( .

@jeroen
Copy link
Contributor

jeroen commented Jul 19, 2023

Dit it actually solve anything for you? In that case maybe you should special case on MSVC. I have never used MSVC so I don't know if it is different from other platforms.

@jeroen
Copy link
Contributor

jeroen commented Jul 19, 2023

OK I think I see the problem. I'll send a PR.

@Faless
Copy link
Contributor Author

Faless commented Jul 19, 2023

Dit it actually solve anything for you?

Yes it did solve my issue (which is how I found #5981 and proposed this solution)

OK I think I see the problem. I'll send a PR.

Thanks 🏅

@jeroen
Copy link
Contributor

jeroen commented Jul 19, 2023

OK I have sent the PR ==> #6602

@ethomson
Copy link
Member

I'm going to temporarily revert this one so that we can get v1.7.1 out the door while #6602 is being reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows - CMake Error: could not resolve ssh2
3 participants