ruby-install
ruby-install copied to clipboard
Failing to compile Ruby 3.0.0
Hello friends,
I keep getting segfaults when trying to install Ruby 3 via ruby-install ruby
(or ruby-install ruby --latest
) with the following output (cropped of course):
...
assembling coroutine/amd64/Context.S
compiling enc/ascii.c
compiling enc/us_ascii.c
compiling enc/unicode.c
compiling enc/utf_8.c
compiling enc/trans/newline.c
compiling ./missing/explicit_bzero.c
compiling ./missing/setproctitle.c
compiling addr2line.c
compiling dmyenc.c
linking miniruby
config.status: creating ruby-runner.h
make: *** [exe/ruby] Segmentation fault: 11
make: *** Deleting file `exe/ruby'
!!! Compiling ruby 3.0.0 failed!
For whatever it's worth, here's some info about my environment:
# MacOS: 10.15.3
$ brew --version
Homebrew 2.7.7
Homebrew/homebrew-core (git revision bedb5; last commit 2021-01-29)
Homebrew/homebrew-cask (git revision 3d72f8; last commit 2021-01-29)
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ ruby-install --version
ruby-install: 0.8.1
Am I missing some requirements or do I have incompatible versions of dependencies? (Would be surprised by the latter since that implies the Homebrew formula for Ruby doesn't actually/correctly list or fetch the dependencies it needs)
Thanks y'all
I have exact same issues, Does any one knowwhat happen? and what should we do?
Can this be reproduced by compiling ruby-3.0.0 manually?
wget https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.xz
tar -xJvf ruby-3.0.0.tar.xz
cd ruby-3.0.0
./configure --with-opt-dir="$(brew --prefix openssl):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm)"
make
If so, this may be an upstream incompatibility bug.
Had the same "Compiling ruby failed" issued. Turns out it is because the ruby installation does not work with openssl3.
Solution
- Check if you have openssl1.1 already installed via hombrew. If not, then install it as follows
- brew install rbenv/tap/[email protected]
- Now install ruby by providing the path to openssl1.1
- ruby-install ruby -- --with-openssl-dir=/usr/local/opt/[email protected]
You can also get the path to the install openssl as follow
- echo $(brew --prefix [email protected])
I can reliably reproduce a failure to install 3.0.0
. But installing 3.2.0
works fine. Seeing as everyone in this issue was installing the latest version (ruby-install ruby
), this should only affect the small subset of people who specifically need 3.0.0
for some reason.
if you are doing this from rbenv:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/[email protected]" rbenv install 2.6.7
I have recently added some logic to dynamically install the [email protected]
or openssl@3
homebrew package depending on the version of Ruby. See a37e332e055da91db5fb053a3d94ebb0f219043d This will be released shortly in ruby-install 0.9.3.
Also, ruby-install 0.9.3 now specifies --with-openssl-dir
instead of just
--with-opt-dir
, which apparently Ruby's configure
script treats with more
precedence, and should prevent it from using another detected instance of
openssl on the system.
However, this comes with a few caveats:
- This is risky, because openssl-1.1 has reached End-of-Life. It will not receive anymore security updates. While I understand people have legacy apps they must maintain, running old unmaintained versions of software is risky. I strongly recommend that people upgrade to at least Ruby 3.1, which uses openssl-3.0.
- This only works for homebrew users. Linux and other BSD package managers only provide one version of openssl, and that's most likely openssl-3.0, as openssl-1.1 has reached End-of-Life.
- I will eventually remove this complex logic after Ruby 3.0 reaches End-of-Life, which was the last Ruby version to use openssl-1.1. After that point, if users still need to install Ruby 2.7 or 3.0, they will have to specify
-- --with-openssl-dir=/path/to/[email protected]
themselves.
Comment or reopen this issue if you still have issues with ruby-install
0.9.3.