Skip to content

build: stop requiring libssl from openssl - #1128

Closed
vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:openssl-stop-requiring-libssl
Closed

vszakats wants to merge 1 commit into
libssh2:masterfrom
vszakats:openssl-stop-requiring-libssl

Conversation

@vszakats

@vszakats vszakats commented Jul 20, 2023 •

Copy link
Copy Markdown
Member

libssh2 does not use or need the TLS/SSL library of OpenSSL.
It only needs libcrypto.

Closes #1128

@vszakats vszakats added the build label Jul 20, 2023
vszakats added a commit to vszakats/libssh2 that referenced this pull request Jul 20, 2023
libssh2 does not use or need the TLS/SSL library of OpenSSL.
It only needs libcrypto.

Closes libssh2#1128
@vszakats
vszakats force-pushed the openssl-stop-requiring-libssl branch from d33b4f2 to 0832b8f Compare July 20, 2023 16:50
@vszakats vszakats changed the title openssl: stop requiring libssl build: stop requiring libssl from openssl Jul 20, 2023
libssh2 does not use or need the TLS/SSL library of OpenSSL.
It only needs libcrypto.

Closes libssh2#1128
@vszakats
vszakats force-pushed the openssl-stop-requiring-libssl branch 3 times, most recently from c3a7195 to 87d9db0 Compare July 21, 2023 02:13
@vszakats vszakats closed this in c84745e Jul 21, 2023
@vszakats
vszakats deleted the openssl-stop-requiring-libssl branch July 21, 2023 12:23
vszakats added a commit to vszakats/libssh2 that referenced this pull request Jul 21, 2023
@vszakats

Copy link
Copy Markdown
Member Author

VMS keeps linking libssl. This patch did not touch it out of caution:

--- a/vms/libssh2_make_example.dcl
+++ b/vms/libssh2_make_example.dcl
@@ -112,7 +112,6 @@ $ then
 $   open/write lout 'link_opts'
 $   write lout "libssh2.olb/lib"
 $   write lout "sys$share:ssl$libcrypto_shr32.exe/share"
-$   write lout "sys$share:ssl$libssl_shr32.exe/share"
 $   write lout "gnv$libzshr/share"
 $   close lout
 $ else
diff --git a/vms/libssh2_make_lib.dcl b/vms/libssh2_make_lib.dcl
index a763445e..d54c01e5 100644
--- a/vms/libssh2_make_lib.dcl
+++ b/vms/libssh2_make_lib.dcl
@@ -100,7 +100,6 @@ $ open/write uitv link_libssh2_version_'majorv'_'minorv'_'patchv'.opt
 $ write uitv "GSMATCH=LEQUAL,''majorv',''cversion'"
 $ write uitv "IDENTIFICATION=""LIBSSH2 ''majorv'.''minorv'.''patchv'"""
 $ write uitv "sys$share:ssl$libcrypto_shr32.exe/share"
-$ write uitv "sys$share:ssl$libssl_shr32.exe/share"
 $ write uitv "gnv$libzshr/share"
 $ close uitv
 $!

lampmanyao pushed a commit to lampmanyao/libssh2 that referenced this pull request Sep 3, 2023
libssh2 does not use or need the TLS/SSL library of OpenSSL.
It only needs libcrypto.

Closes libssh2#1128
vszakats added a commit to curl/curl-for-win that referenced this pull request Dec 12, 2023
Upcoming libssh2 version doesn't want to to copy the ssl dll anymore.

Ref: libssh2/libssh2#1128
Ref: libssh2/libssh2@c84745e
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
libssh2 does not use or need the TLS/SSL library of OpenSSL.
It only needs libcrypto.

Closes libssh2#1128
vszakats added a commit to vszakats/libssh2 that referenced this pull request Oct 4, 2024
vszakats added a commit to vszakats/libssh2 that referenced this pull request Oct 4, 2024
vszakats added a commit to vszakats/libssh2 that referenced this pull request Jul 13, 2025
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 added a commit that referenced this pull request Jul 13, 2025
The `libssh2.pc` generator logic automatically adds `-lws2_32` while
parsing `LIBSSH2_LIBS`, which contains this lib already. Then discard
the duplicate.

This patch introduces a change in the position of `ws2_32` within
the lib list advertised via `libssh2.pc` for static builds.

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 #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 #1535

For these reasons it seems unlikely this position change could break
Windows OpenSSL static gcc/ld builds relying on `libssh2.pc` for their
lib 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 on `ws2_32`, and
the `bcrypt` dependency is also causing breakage with picky binutils ld.
I may try addressing it in a separate PR.

Ref: 33b6d5f #827
Ref: 31fb886 #811

Closes #1619
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.

1 participant