postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.89k stars 250 forks source link

Prefer --with-openssl-dir #468

Closed k0kubun closed 10 months ago

k0kubun commented 10 months ago

Fix https://github.com/postmodern/ruby-install/issues/458

When your homebrew has both openssl@1.1 and openssl@3 and you pass --with-opt-dir=/opt/homebrew/opt/openssl@1.1 to configure, the build somehow mixes up both versions and fails.

It looks like --with-openssl-dir is the only correct way to specify an OpenSSL directory https://github.com/postmodern/ruby-install/issues/458#issuecomment-1667744262, so this PR uses it for Ruby 3.1.1 and newer (ref: https://github.com/postmodern/ruby-install/issues/458#issuecomment-1667746749). Older versions use the same option for backward compatibility, which would hopefully work if you don't have openssl@3 locally.

postmodern commented 10 months ago

In issue #461, we're considering just switching to OpenSSL 3.x as the default. Most other Linux distributions have already switched to openssl 3.x and do not provide a legacy openssl 1.1 package. Seeing as how Ruby 3.0 will reach End-Of-Life March 31st, 2024, should we even bother supporting older Ruby versions?

k0kubun commented 10 months ago

should we even bother supporting older Ruby versions?

I changed the patch to always use --with-openssl-dir. I'll leave it to you to decide whether you merge this first or just do this in your OpenSSL 3 change together. As long as --with-openssl-dir will be used at some point, I'd be happy.

postmodern commented 10 months ago

@k0kubun just to get clarification, can the openssl installation directory be specified using --with-opt-dir, or must it be specified using --with-openssl-dir? Should ruby-install replace usage of --with-opt-dir with individual --with-*-dir options for each Ruby dependency (ex: --with-openssl-dir=... --with-yaml-dir=... ...)?

k0kubun commented 10 months ago

can the openssl installation directory be specified using --with-opt-dir, or must it be specified using --with-openssl-dir?

I believe it must be --with-openssl-dir. On the openssl.gem side, it's the only documented way to build it https://github.com/ruby/openssl#installation. Specifying an OpenSSL directory with --with-opt-dir seems to partially work, but the rest of it relies on something not controlled by --with-opt-dir.

Should ruby-install replace usage of --with-opt-dir with individual --with-*-dir options for each Ruby dependency (ex: --with-openssl-dir=... --with-yaml-dir=... ...)?

TBH I'm not sure what's the best practice for libyaml and gdbm. I've been able to build Ruby without specifying anything special for those things while I've often needed explicit --with-openssl-dir on macOS with homebrew for fixing build issues. I'd say it's fine to leave those two as is unless we know it's breaking something.