From c8b3bd45cc3cae93ae701333202416838ee6a00c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 7 Jul 2022 09:32:43 -0400 Subject: [PATCH] Fix extconf.rb for OpenSSL 3 without $warnflags On Windows with OpenSSL 3, the gem fails to compile with the following error message: ruby/src/ext/openssl/extconf.rb:188: undefined method \`sub!' for nil:NilClass This is because $warnflags is nil. --- ext/openssl/extconf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index 467f7e7a86..26abfc8b2a 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -185,7 +185,7 @@ have_func("EVP_PKEY_dup") Logging::message "=== Checking done. ===\n" if openssl_3 - if $warnflags.sub!(/-W\K(?=deprecated-declarations)/, 'no-') + if $warnflags&.sub!(/-W\K(?=deprecated-declarations)/, 'no-') $warnflags << " -Wno-incompatible-pointer-types-discards-qualifiers" end end