Repository navigation
Conversation
The `libssh2.pc` generator logic automatically adds `-lws2_32` while parsing `LIBSSH2_LIBS`, which contains this lib already. Then discard the duplicate. This change introduces a change in the position of `ws2_32` within the lib list. This order might in cases by significant, but: - libssh2 no longer links against `libssl`, which was the library also referencing `ws2_32` and breaking picky binutils `ld` linker when not passed in strict dependency order. Ref: c84745e libssh2#1128 - since switching to INTERFACE targets, cmake messes up the lib order anyway, adding `OpenSSL:Crypto` last, instead of `ws2_32`. This did not seem to cause an issue so far. Ref: df0563a libssh2#1535 Ref: 33b6d5f libssh2#827 Ref: 31fb886 libssh2#811
vszakats
marked this pull request as draft
July 13, 2025 12:25
vszakats
marked this pull request as ready for review
July 13, 2025 12:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
libssh2.pcgenerator logic automatically adds-lws2_32whileparsing
LIBSSH2_LIBS, which contains this lib already. Then discardthe duplicate.
This patch introduces a change in the position of
ws2_32withinthe lib list advertised via
libssh2.pcfor static builds.This order might in cases by significant, but:
libssh2 no longer links against
libssl, which was the libraryalso referencing
ws2_32and breaking picky binutilsldlinkerwhen not passed in strict dependency order.
Ref: c84745e build: stop requiring libssl from openssl #1128
since switching to INTERFACE targets, cmake messes up the lib order
anyway, adding
OpenSSL:Cryptolast, instead ofws2_32. This didnot seem to cause an issue so far.
Ref: df0563a cmake: make Find modules use
INTERFACE#1535For these reasons it seems unlikely this position change could break
Windows OpenSSL static gcc/ld builds relying on
libssh2.pcfor theirlib list. It least no more than it was before this patch.
Turns out these theories don't stand in practice and the order is broken
possibly by introducing INTERFACE targets, with or without this patch.
libcrypto(tested with LibreSSL) is in fact depending onws2_32, andthe
bcryptdependency is also causing breakage with picky binutils ld.I may try addressing it in a separate PR.
Ref: 33b6d5f #827
Ref: 31fb886 #811
Sigh... the amount of wasted time on the binutils ld linker is just
insane. Of course it's broken after the INTERFACE change. Not only
because of
crypt32andbcrypt, but libcrypto (LibreSSL) alsodepends on
ws2_32for some reason.ntohl,inet_ptonandeven
setsockopt.