Skip to content

Commit

Permalink
Fix extconf.rb for OpenSSL 3 without $warnflags
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
peterzhu2118 committed Jul 7, 2022
1 parent 4d8f12b commit c8b3bd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/openssl/extconf.rb
Expand Up @@ -185,7 +185,7 @@ def find_openssl_library
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
Expand Down

0 comments on commit c8b3bd4

Please sign in to comment.