When trying to use rbenv to install a new ruby version, I keep getting build failures on Mac OS:
trevoraron#Trevor-Aron api % rbenv install 2.6.7
Downloading ruby-2.6.7.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.7.tar.bz2
Installing ruby-2.6.7...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.3.1 using ruby-build 20220426)
Inspect or clean up the working tree at /var/folders/pk/y07ms18x3l98w09j6dj4p_680000gn/T/ruby-build.20220606121206.1319.GLeYbo
Results logged to /var/folders/pk/y07ms18x3l98w09j6dj4p_680000gn/T/ruby-build.20220606121206.1319.log
Last 10 log lines:
219 warnings generated.
193 warnings generated.
201 warnings generated.
384 warnings generated.
219 warnings generated.
306 warnings generated.
201 warnings generated.
271 warnings generated.
217 warnings generated.
261 warnings generated.
I'm running on x86
Are you trying to install in a M1? I had a similar issue and fixed by running:
CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS='--with-readline-dir=/usr/local/opt/readline/' arch -x86_64 rbenv install 3.1.2
Related
I am having issues installing Ruby with rbenv and it appears to be an openssl issue. I have followed the below links with no success
Links:
OpenSSL error installing Ruby 2.1.x and 2.3.x on Archlinux with ruby-install/ruby-build
https://github.com/rbenv/ruby-build/wiki#openssl-sslv3_method-undeclared-error
Ubuntu 20.04
OpenSSL 1.0.2
ruby-build 20211019
scoop#scoop-VirtualBox:~$ rbenv install 1.9.3-p327
Downloading yaml-0.1.6.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/scoop/.rbenv/versions/1.9.3-p327
Downloading ruby-1.9.3-p327.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.bz2
Installing ruby-1.9.3-p327...
WARNING: ruby-1.9.3-p327 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
BUILD FAILED (Ubuntu 20.04 using ruby-build 20211019)
Inspect or clean up the working tree at /tmp/ruby-build.20211022151319.51817.ZFwydR
Results logged to /tmp/ruby-build.20211022151319.51817.log
Last 10 log lines:
| ^~~~~~~~~~~~
ossl_ocsp.c: In function ‘ossl_ocspcid_get_serial’:
ossl_ocsp.c:694:1: warning: control reaches end of non-void function [-Wreturn-type]
694 | }
| ^
make[2]: *** [Makefile:267: ossl_ocsp.o] Error 1
make[2]: Leaving directory '/tmp/ruby-build.20211022151319.51817.ZFwydR/ruby-1.9.3-p327/ext/openssl'
make[1]: *** [exts.mk:126: ext/openssl/all] Error 2
make[1]: Leaving directory '/tmp/ruby-build.20211022151319.51817.ZFwydR/ruby-1.9.3-p327'
make: *** [uncommon.mk:178: build-ext] Error 2
I found Ubuntu > 18.04 does not have the correct dependencies to support OpenSSL 1.0 so I switched to 18.04 and did the following:
# cd into source directory you downloaded and unarchived
./config --prefix=/opt/openssl-1.0 shared
make
make test
sudo make install
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/openssl-1.0" rbenv install <version>
this comes from the below link:
https://github.com/rbenv/ruby-build/wiki#openssl-sslv3_method-undeclared-error
I'm trying to install ruby 2.2.10 with ASDF without success. I tried to find on my own why it's this happening now. Not sure if some brew update it breaks it or what.
Here I share the output of the install:
asdf install
elixir 1.10.2-otp-22 is already installed
elm 0.18.0 is already installed
istioctl 1.4.7 is already installed
Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/murbano/.asdf/installs/ruby/2.2.10
Downloading ruby-2.2.10.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.10.tar.bz2
Installing ruby-2.2.10...
WARNING: ruby-2.2.10 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (OS X 10.15.6 using ruby-build 20200520)
Inspect or clean up the working tree at /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921205118.64211.ty44rI
Results logged to /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921205118.64211.log
Last 10 log lines:
compiling complex.c
compiling dir.c
compiling dln_find.c
compiling encoding.c
encoding.c:825:2: error: implicit declaration of function 'rb_str_change_terminator_length' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rb_str_change_terminator_length(obj, oldtermlen, termlen);
^
1 error generated.
make: *** [encoding.o] Error 1
make: *** Waiting for unfinished jobs....
Also tried with:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" asdf install
elixir 1.10.2-otp-22 is already installed
elm 0.18.0 is already installed
istioctl 1.4.7 is already installed
Downloading ruby-2.2.10.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.10.tar.bz2
Installing ruby-2.2.10...
WARNING: ruby-2.2.10 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (OS X 10.15.6 using ruby-build 20200520)
Inspect or clean up the working tree at /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921210737.34707.yrr2le
Results logged to /var/folders/47/wxs46t2s6db9fh1zv640mpdr0000gn/T/ruby-build.20200921210737.34707.log
Last 10 log lines:
compiling dln_find.c
compiling encoding.c
compiling enum.c
encoding.c:825:2: error: implicit declaration of function 'rb_str_change_terminator_length' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rb_str_change_terminator_length(obj, oldtermlen, termlen);
^
compiling enumerator.c
1 error generated.
make: *** [encoding.o] Error 1
make: *** Waiting for unfinished jobs....
brew --prefix openssl
/usr/local/opt/openssl#1.1
I installed XCode, restarted, something it's stoping the install but I'm not sure why.
That happened after uninstalled ruby to do a new clean install.
I tried to install ruby 2.5.0 with rbenv and ruby-build on macOS Sierra, but it failed and I got error messages as below:
$ rbenv install 2.5.0
Downloading openssl-1.1.0g.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/de4d501267da39310905cb6dc8c6121f7a2cad45a7707f76df828fe1b85073af
Installing openssl-1.1.0g...
Installed openssl-1.1.0g to /Users/hikaru/.rbenv/versions/2.5.0
Downloading ruby-2.5.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.bz2
Installing ruby-2.5.0...
BUILD FAILED (OS X 10.12.6 using ruby-build 20171226)
Inspect or clean up the working tree at
/var/folders/5q/dy9blchn6fq1_673pm0ybt0h0000gn/T/ruby-
build.20180102205530.13528
Results logged to /var/folders/5q/dy9blchn6fq1_673pm0ybt0h0000gn/T/ruby-build.20180102205530.13528.log
Last 10 log lines:
make[1]: *** Waiting for unfinished jobs....
installing default ripper libraries
compiling ancdata.c
compiling raddrinfo.c
compiling ifaddr.c
installing default socket libraries
linking shared-object zlib.bundle
linking shared-object socket.bundle
linking shared-object ripper.bundle
make: *** [build-ext] Error 2
I checked the log files and found the error below:
ossl_x509cert.c:334:59: error: member reference type 'int' is not a pointer
if (!i2a_ASN1_OBJECT(out, X509_get0_tbs_sigalg(x509)->algorithm)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
I have no idea why this error happens. I would appreciate it if you would explain how to solve this problem.
After then, I tried to rbenv install 2.5.0 with gcc provided by Xcode on macOS High Sierra, and same problem happened.
It works for me on the same OS. An issue in ruby-build that produced this error was reported and fixed recently.
Update rbenv and ruby-build
If you're getting them from git:
cd ~/.rbenv
git pull
cd plugins/ruby-build
git pull
If you're getting them from homebrew:
brew update
brew upgrade rbenv ruby-build
and try rbenv install 2.5.0 again.
If you're using rbenv & ruby-build homebrew, you could try using them from git.
I finally fixed this problem. When this problem happened, my rbenv treid to install ruby 2.5.0 using openssl-1.1.0g. This openssl was selected by rbenv and ruby-build.
In my environment, I installed openssl#1.0.2n_0 by MacPort. I selected this openssl to installing ruby 2.5.0 with rbenv and ruby-build.
$ rbenv versions
system
* 2.4.0
$ port installed | grep openssl
openssl #1.0.2n_0 (active)
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/local --with-gdbm-dir=/opt/local" rbenv install -v 2.5.0
$ rbenv versions
system
* 2.4.0
2.5.0
When I did not use --with-gdbm-dir=/opt/local, I got the below message:
*** Following extensions are not compiled:
gdbm:
Could not be configured. It will not be installed.
Check ext/gdbm/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
use this to install ruby last version with rbenv
RUBY_CONFIGURE_OPTS="--disable-dtrace" rbenv install 2.5.1
So, as the title suggests, I'm trying to install ruby 2.1.2, altough I've tried to install other versions as well, and I'm getting the same errors. I'm running OSX 10.9.2.
I've tried:
Installing a fresh gcc compiler, via brew install gcc47
Installing updated OSX command line tools
Uninstalling rbenv and trying again
Restarting the machine
Here is the sum of what I'm getting:
rbenv install 2.1.2
Downloading ruby-2.1.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/f22a6447811a81f3c808d1c2a5ce3b5f5f0955c68c9a749182feb4 25589e6635
Installing ruby-2.1.2...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/6c/h_82199n12515_hd3rcp2x5w0000gn/T/ruby-build.20140528115901.38728
Results logged to /var/folders/6c/h_82199n12515_hd3rcp2x5w0000gn/T/ruby-build.20140528115901.38728.log
Last 10 log lines:
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
compiling miniinit.c
compiling miniprelude.c
translating probes probes.d
compiling bignum.c
compiling class.c
dtrace: failed to compile script probes.d: Preprocessor not found
make: *** [probes.h] Error 1
make: *** Waiting for unfinished jobs....
compiling compar.c
Thoughts?
Gist of verbose output
I was able to build it using:
CONFIGURE_OPTS="--disable-dtrace" rbenv install 2.1.2
Basically that's what is suggested in the question's comment by wicz.
The solution by KurtPreston did not work for me. Also using OS X 10.9.
I was able to get this working in my own environment by:
Removing the gcc installed by Homebrew: brew remove gcc47
Re-installing the XCode Command Line Tools from the XCode Downloads page at https://developer.apple.com/downloads
I was trying to install 2.0 and ran into the same error. However now the CONFIGURE_OPTIONS override doesn't seem to work anymore with rvm at least, so I needed to build it with rvm install --reconfigure -C --disable-dtrace ruby-2.0.0-p594. This was the first Google result off the error message ("dtrace: failed to compile script probes.d: Preprocessor not found") so I figured I should add this as a current solution for rvm users. Running on OSX Mavericks.
I cannot reproduce this on my machine, sorry. For reference, here's my dtrace version if that should have anything to do with the error:
dtrace -V
dtrace: Sun D 1.7
You can try to check for XCode and command line tools updates. GCC 4 should not be necessary, you can use the compiler that ships with XCode:
brew uninstall gcc4
Finally, update everything and try again:
brew update
brew upgrade rbenv ruby-build
rbenv uninstall 2.1.2
rbenv install 2.1.2
If that does not work yet: some people have reported that a simple reboot of the machine solved similar errors with dprobe/dtrace.
I'm quite new to rbenv let alone ruby and having some difficulty diagnosing the following installation failure:
rbenv install 2.0.0-p0
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /Users/Haani/.rbenv/versions/2.0.0-p0
Downloading ruby-2.0.0-p0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/50d307c4dc9297ae59952527be4e755d
Installing ruby-2.0.0-p0...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/50/wzjqg8d11sn7xnkrsmgr1gn80000gn/T/ruby-build.20140420110650.75863
Results logged to /var/folders/50/wzjqg8d11sn7xnkrsmgr1gn80000gn/T/ruby-build.20140420110650.75863.log
Last 10 log lines:
compiling ossl_x509cert.c
compiling ossl_x509crl.c
compiling ossl_x509ext.c
compiling ossl_x509name.c
compiling ossl_x509req.c
compiling ossl_x509revoked.c
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object openssl.bundle
make: *** [build-ext] Error 2
See full log here
There seems to be a problem with the Homebrew package "readline".
brew uninstall readline
brew install https://raw.githubusercontent.com/Homebrew/homebrew/0181c8a1633353affefabe257c170edbd6d7c008/Library/Formula/readline.rb
brew pin readline
Then retry installing ruby with
rbenv install 2.0.0-p0
Answer found thanks to https://github.com/sstephenson/rbenv/issues/579#issuecomment-41122071
I needed to update my command line tools.
sudo rm -rf /Library/Developer/CommandLineTools
Then
sudo xcode-select --install