Skip to content

Commit

Permalink
Find link order issues for openssl on 3.2.2 and 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Jan 23, 2024
1 parent ec4a374 commit 864fbfc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
21 changes: 17 additions & 4 deletions recipes/ruby/all/patches/0003-openssl-zlib-ext-3.2.2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
have_library("crypt32")
+ have_library("advapi32")
end

return false unless have_header("openssl/ssl.h")
@@ -57,8 +58,12 @@ def find_openssl_library

if $mswin
# OpenSSL >= 1.1.0: libcrypto.lib and libssl.lib.
+ # Potentially with 'd' appended (conan center index)
Expand All @@ -22,13 +22,26 @@ diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
+ have_library("libssld", "SSL_new")
return true
end


@@ -95,6 +100,12 @@ end
Logging::message "=== Checking for required stuff... ===\n"
pkg_config_found = !dir_config_given && pkg_config("openssl") && have_header("openssl/ssl.h")

+# Force finding the PKG config anyways because we want to grab the one
+# generated by conan to avoids the library linking order issue
+# (dl lz need to be after lssl and co).
+pkg_config("openssl")
+
+
if !pkg_config_found && !find_openssl_library
Logging::message "=== Checking for required stuff failed. ===\n"
Logging::message "Makefile wasn't created. Fix the errors above.\n"
diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb
--- ext/zlib/extconf.rb
+++ ext/zlib/extconf.rb
@@ -11,7 +11,7 @@ require 'rbconfig'
dir_config 'zlib'

libs = $libs
-if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and
+if %w'z zlibstatic zlibstaticd zlib zlibd libz zlib1 zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and
Expand Down
22 changes: 16 additions & 6 deletions recipes/ruby/all/patches/0003-openssl-zlib-ext-3.3.0.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 56f4a1c..1d45d88 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
--- ext/openssl/extconf.rb
+++ ext/openssl/extconf.rb
@@ -68,6 +68,7 @@ def find_openssl_library
# required for static OpenSSL libraries
have_library("gdi32") # OpenSSL <= 1.0.2 (for RAND_screen())
Expand All @@ -24,10 +23,21 @@ index 56f4a1c..1d45d88 100644
return true
end

@@ -116,6 +121,11 @@ end
Logging::message "=== Checking for required stuff... ===\n"
pkg_config_found = !dir_config_given && pkg_config("openssl") && have_header("openssl/ssl.h")

+# Force finding the PKG config anyways because we want to grab the one
+# generated by conan to avoids the library linking order issue
+# (dl lz need to be after lssl and co).
+pkg_config("openssl")
+
if !pkg_config_found && !find_openssl_library
Logging::message "=== Checking for required stuff failed. ===\n"
Logging::message "Makefile wasn't created. Fix the errors above.\n"
diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb
index 2b2dbb1..2abc037 100644
--- a/ext/zlib/extconf.rb
+++ b/ext/zlib/extconf.rb
--- ext/zlib/extconf.rb
+++ ext/zlib/extconf.rb
@@ -11,7 +11,7 @@ require 'rbconfig'
dir_config 'zlib'

Expand Down

0 comments on commit 864fbfc

Please sign in to comment.