Skip to content

Commit

Permalink
[GR-18163] Do not consider deprecated functions as errors for core C …
Browse files Browse the repository at this point in the history
…extensions and prefer OpenSSL 3.0, then OpenSSL 3.x, then OpenSSL 1.1

PullRequest: truffleruby/4445
  • Loading branch information
eregon committed Jan 8, 2025
2 parents adb9fd1 + eadfc4f commit c477593
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bug fixes:

* Fix `Module#name` called inside the `Module#const_added` callback when the module is defined in the top-level scope (#3683, @andrykonchin).
* Fix duplicated calls of a `Module#const_added` callback when a module with nested modules is assigned to a constant (@andrykonchin).
* Support OpenSSL 1.1-3.4 and prefer in order OpenSSL 3.0.x, 3.x and 1.1 (EOL). There was a compilation issue with OpenSSL 3.4 (#3724, @eregon).

Compatibility:

Expand Down
2 changes: 1 addition & 1 deletion lib/cext/include/truffleruby/truffleruby-abi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
// $RUBY_VERSION must be the same as TruffleRuby.LANGUAGE_VERSION.
// $ABI_NUMBER starts at 1 and is incremented for every ABI-incompatible change.

#define TRUFFLERUBY_ABI_VERSION "3.3.5.7"
#define TRUFFLERUBY_ABI_VERSION "3.3.5.8"

#endif
3 changes: 3 additions & 0 deletions lib/truffle/rbconfig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ module RbConfig

warnflags << '-Wundef' # Warn for undefined preprocessor macros for core C extensions
warnflags << '-Werror' # Make sure there are no warnings in core C extensions
# If there are deprecations in core C extensions, do not error for them.
# This would be problematic for extconf.rb checks as they would think such deprecated functions do not exist.
warnflags << '-Wno-error=deprecated-declarations'
else
libtruffleruby = "#{cext_dir}/libtruffleruby.#{soext}"
libtrufflerubytrampoline = "#{cext_dir}/libtrufflerubytrampoline.#{soext}"
Expand Down
19 changes: 14 additions & 5 deletions lib/truffle/truffle/openssl-prefix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
# GNU General Public License version 2, or
# GNU Lesser General Public License version 2.1.

# Set OPENSSL_PREFIX in ENV to find the OpenSSL headers
# From https://openssl-library.org/policies/releasestrat/index.html
# 3.0 is LTS, 3.1+ is non-LTS and 1.1 is EOL

# See the existing formula at https://github.com/Homebrew/homebrew-core/tree/master/Formula/o
search_homebrew = -> homebrew {
if prefix = "#{homebrew}/opt/[email protected]" and Dir.exist?(prefix)
if prefix = "#{homebrew}/opt/[email protected]" and Dir.exist?(prefix)
prefix
elsif prefix = "#{homebrew}/opt/openssl@3" and Dir.exist?(prefix)
prefix
elsif prefix = "#{homebrew}/opt/[email protected]" and Dir.exist?(prefix)
prefix
elsif prefix = "#{homebrew}/opt/openssl" and Dir.exist?(prefix)
prefix
Expand All @@ -26,17 +32,20 @@
homebrew = `brew --prefix 2>/dev/null`.strip
homebrew = nil unless $?.success? and !homebrew.empty? and Dir.exist?(homebrew)

# See https://ports.macports.org/search/?q=openssl&name=on for the list of MacPorts openssl ports
if homebrew and prefix = search_homebrew.call(homebrew)
# found
elsif Dir.exist?('/opt/local/libexec/openssl11') # MacPorts, prefer OpenSSL 1.1 as known to be compatible
elsif Dir.exist?('/opt/local/libexec/openssl3')
prefix = '/opt/local/libexec/openssl3'
elsif Dir.exist?('/opt/local/libexec/openssl11')
prefix = '/opt/local/libexec/openssl11'
# MacPorts, try the generic version, too, but might not be compatible
elsif Dir.exist?('/opt/local/include/openssl')
elsif Dir.exist?('/opt/local/include/openssl') # symlinks, unknown version
prefix = '/opt/local'
end
end

if prefix
# Set OPENSSL_PREFIX in ENV to find the OpenSSL headers
ENV['OPENSSL_PREFIX'] = prefix
else
abort 'Could not find OpenSSL headers, install via Homebrew or MacPorts or set OPENSSL_PREFIX'
Expand Down
5 changes: 0 additions & 5 deletions src/main/c/openssl/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@

require "mkmf"

if defined?(::TruffleRuby)
# Needed with libssl 3.0.0 and -Werror from building core C extensions
$warnflags += ' -Wno-deprecated-declarations'
end

ssl_dirs = nil
if defined?(::TruffleRuby)
# Always respect the openssl prefix chosen by truffle/openssl-prefix
Expand Down

0 comments on commit c477593

Please sign in to comment.