Can't install ruby 1.8.7 Mac OS X Sierra - ruby

I'm trying to (re-)install ruby 1.8.7 using rvm 1.29.1 on a brand new MBP running OS X Sierra. I HAVE to get this done for work, I'm not in a position to switch to a more current version or anything unfortunately.
I had a functional install of this but after getting some weird errors in a project decided to try a completely clean reinstall of both rvm (and eventually homebrew!) (long story- had a broken file structure after removing an unwanted space from the name of my home directory!). I was careful to remove all traces of the old install from .bashrc, .profile etc following other posts on here. 2.4.0 installs and runs fine. However, on trying to install 1.8.7:
9bxbniv1:~ Rob$ rvm install ruby-1.8.7
Warning! Requested ruby installation which requires another ruby available - installing ruby-1.8.7-p374 first.
ruby-1.8.7-p374 - #removing src/ruby-1.8.7-p374..
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl#1.1/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/Rob/.rvm/rubies/ruby-1.8.7-p374, this may take a while depending on your cpu(s)...
ruby-1.8.7-p374 - #downloading ruby-1.8.7-p374, this may take a while depending on your connection...
ruby-1.8.7-p374 - #extracting ruby-1.8.7-p374 to /Users/Rob/.rvm/src/ruby-1.8.7-p374....
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/no_sslv2.diff.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/GH-488.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/ssl_no_ec2m.patch.
ruby-1.8.7-p374 - #configuring...............................
ruby-1.8.7-p374 - #post-configuration.
ruby-1.8.7-p374 - #compiling................................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/Rob/.rvm/log/1488471654_ruby-1.8.7-p374/make.log
^
openssl_missing.c:107:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->o_ctx);
^
openssl_missing.c:108:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->md_ctx);
^
In file included from /usr/include/string.h:192:0,
from openssl_missing.c:19:
openssl_missing.c:109:27: error: invalid application of 'sizeof' to incomplete type 'HMAC_CTX'
memset(ctx, 0, sizeof(HMAC_CTX));
^
make[1]: *** [openssl_missing.o] Error 1
make: *** [all] Error 1
+++ return 2
There has been an error while running make. Halting the installation.
To proceed rvm requires a ruby-1.8.7-p374 compatible ruby is installed.
We attempted to install it automatically but it failed with status 2.
Please install it manually (or a compatible alternative) to proceed.
I have tried some of the hacks suggested in Getting Ruby 1.8.7 installed on Mountain Lion (10.8) but unfortunately that didn't help.
Looking further into the log file the error begins with the following message:
In file included from openssl_missing.c:22:0:
openssl_missing.h:79:35: error: macro "EVP_MD_CTX_create" passed 1 arguments, but takes just 0
EVP_MD_CTX *EVP_MD_CTX_create(void);
^
In file included from /usr/local/opt/openssl#1.1/include/openssl/x509.h:23:0,
from /usr/local/opt/openssl#1.1/include/openssl/x509_vfy.h:17,
from openssl_missing.c:16:
/usr/local/opt/openssl#1.1/include/openssl/evp.h:501:51: error: expected declaration specifiers or '...' before '(' token
# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx))
Searching for the first line of this error returned 0 results on here. Suggestions would be gratefully received.

I was able to get this working via RVM using a variant of rbenv code I found # https://gist.github.com/davidkellis/909449e13905d8bfbd49c30d20f7fbca . I already had xcode and openssl.
rvm install 1.8.7 --with-openssl-dir=`brew --prefix openssl`

The latest development version of RVM should work:
rvm get head
I also updated XCode to version 8.2.1 before I upgraded RVM, if you do upgrade XCode you'll need to launch it and agree the new license or:
sudo xcodebuild -license
I had to upgrade my brew as well and do loads to get it working as it hadn't been touched for a very long time.
I'm not sure if you could just do one in isolation. Mine is up and running now.
I nuked my RVM as I had let it get out of hand. Wish I had just pruned it instead. Now to get the legacy Rails apps up and running.

Ruby 1.8.7 is dead and no longer supported on any modern macOS, so you can't install it. That version of Ruby is a historical artifact at this point, and if you really, really do need to run it, you'll either need to get a historical version of OS X, Linux or BSD which is compatible with it.
My advice is to use Vagrant to build a virtual machine that has an older version of Linux or BSD which can be used to build Ruby 1.8.7. Anything dating from 2010 or earlier will probably work, so Ubuntu 10.04 might be a good place to start.
It's worth noting that Ruby Enterprise Edition is a variant of 1.8.7 that was supported longer than MRI 1.8.7 was, so you may have more success with that version. It was discontinued in 2012.

I ended up restoring my system using time machine. But another colleague had the same problems setting things up on a new machine, and found
rvm install ruby -v 1.8.7--autolibs=enable
helpful, if anyone else stumbles across this.

Related

Undefined symbol: SSLv3_method - .../openssl.so with Ruby and ArchLinux

A recent OpenSSL update on ArchLinux broke Ruby because the latter depends on SSLv3 being supported by the former. Ruby code that uses OpenSSL will reveal the problem when they terminate with an error like the below:
openssl.so: undefined symbol: SSLv3_method - .../openssl.so (LoadError)
I use multiple versions of Ruby with RVM and the problem aplies to all of them.
The OpenSSL version I have the problem with is 1.0.2h but I believe it was introduced with 1.0.2g. Version 1.0.2f works fine.
How can this be compatibility issue be overcome (without downgradng OpenSSL) ?
The problem is caused by the ArchLinux OpenSSL package being built without SSLv3 support, as of this commit. I believe that a similar thing has been done in other distros such as Ubuntu.
The solution in a RVM environment is to reinstall your Rubies which will rebuild them (you may also wish to update to the latest rvm):
$ rvm get head # optional, if you want to!
$ rvm reinstall all # or a specifc ruby version instead of 'all'
However, older rubies will still fail with a compile error like this:
Error running '__rvm_make -j1'
ossl_ssl.c:143:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
This has been discussed with the RVM team who have suggested installing this Ruby patch that allows older rubies to build:
$ curl https://github.com/ruby/ruby/commit/801e1fe46d83c856844ba18ae4751478c59af0d1.diff > openssl.patch
$ rvm install --patch ./openssl.patch 1.9.3-p194
I built ruby-1.9.3-p194, ruby-2.0.0-p247 and ruby-2.2.1 successfully with this patch.

Error running '__rvm_make -j 1' during rvm Ruby installation | openssl error

You are probably searching for Error running '__rvm_make -j 1'
That only says, that something went wrong while compiling ruby. This question is only relevant to you if openssl and/or ossl_ssl is part of your error message.
But maybe your problem is a similar one and you can solve your problem with some customizations.
Background
Today I wanted to delete all gems of a project but forgot to specify a path for bundler beforehand so all gems where installed in ~/.rvm/gems/ruby-2.2.4/gems/.
As it's the only ruby 2.2.4 project I though rm -rf ~/.rvm/gems/ruby-2.2.4/gems/* would be perfectly fine. It wasn't. Bundler was gone and gem install bundler didn't worked anymore as well.
I removed the hole ruby installation with rvm remove ruby-2.2.4 ant tried to reinstall it. This is the console output with the error I got:
Console output
> rvm install ruby-2.2.4
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.11/x86_64/ruby-2.2.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/fkammer/.rvm/rubies/ruby-2.2.4, this may take a while depending on your cpu(s)...
ruby-2.2.4 - #downloading ruby-2.2.4, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12.7M 100 12.7M 0 0 655k 0 0:00:19 0:00:19 --:--:-- 234k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.4 - #extracting ruby-2.2.4 to /Users/fkammer/.rvm/src/ruby-2.2.4....
ruby-2.2.4 - #configuring..........................................................
ruby-2.2.4 - #post-configuration.
ruby-2.2.4 - #compiling..............................................................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/fkammer/.rvm/log/1456431932_ruby-2.2.4/make.log
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:19:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
^~~~~
ossl_ssl.c:2217:21: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:115:14) []'
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:19:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
^~~~~
9 errors generated.
make[2]: *** [ossl_ssl.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
++ return 2
There has been an error while running make. Halting the installation.
Retrying does not change anything. I also tried to completely uninstall rvm (rvm implode) and reinstall it but that was neither successful.
System
Mac OS X – El Capitan (10.11.3)
rvm 1.26.11 (latest)
Homebrew 0.9.5
Looks like there is a problem with openssl.
rvm uses homebrew as its package manager on my installation (it's the default I guess). You can ensure that with rvm autolibs homebrew.
I reinstalled openssl with
brew reinstall openssl
and saw via brew list that there was another openssl package called openssl098 installed on my system. Trying to reinstall it too caused the following error:
> brew reinstall openssl098
Error: No available formula with the name "openssl098"
I just removed the package with
brew uninstall --force openssl098
and reinstalled openssl again to be sure openssl098 wasn't a needed dependency. But it wasn't installed again.
Afterwards I tried installing ruby-2.2.4 via rvm again and it worked like a charm :) So I guess my openssl package was broken for some reason.
openssl098 has been officially removed and is no longer available. Most probably you have outdated version of rvm which tries to build against the 0.9.8 branch. Update rvm to have it fixed: rvm get head. Source.
I was trying to install ruby 1.9.3 but have error as-
Error running '__rvm_make -j4'
I follow #mpapis and got my issue resolved
rvm remove 1.9.3
CC=clang rvm install 1.9.3
Now I have this setup-
rvm rubies
ruby-1.9.3-p551 [ x86_64 ]
ruby-2.1.3 [ x86_64 ]
=* ruby-2.3.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Here is the source link-
https://github.com/rvm/rvm/issues/
& this s my quote on it-
https://github.com/rvm/rvm/issues/2333
This is what worked for me. I always forget to do this. One time thing.
xcode-select --install
brew --prefix openssl # get the path you need for openssl
rvm install "ruby-2.6.4" --with-openssl-dir=PATH_TO_OPENSSL

Issue installing 1.8.7 p358 under RVM

After getting Xcode rvm install 1.9.3 works totally fine. However, rvm install 1.8.7 throws the following error.
~ ☺ rvm install 1.8.7
Installing Ruby from source to: /Users/jordanscales/.rvm/rubies/ruby-1.8.7-p358, this may take a while depending on your cpu(s)...
ruby-1.8.7-p358 - #fetching
ruby-1.8.7-p358 - #extracting ruby-1.8.7-p358 to /Users/jordanscales/.rvm/src/ruby-1.8.7-p358
Error running 'tar xjf /Users/jordanscales/.rvm/archives/ruby-1.8.7-p358.tar.bz2 -C /Users/jordanscales/.rvm/tmp/rvm_src_30581 ', please read /Users/jordanscales/.rvm/log/ruby-1.8.7-p358/extract.log
There has been an error while trying to extract the source.
Halting the installation.
There has been an error fetching the ruby interpreter. Halting the installation.
Please be aware that you just installed a ruby that requires 2 patches just to be compiled on up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to Ruby 1.9.3-194 which will have all of the latest security patches.
~ ☺
The log reads
[2012-06-04 17:06:23] tar xjf /Users/jordanscales/.rvm/archives/ruby-1.8.7-p358.tar.bz2 -C /Users/jordanscales/.rvm/tmp/rvm_src_30581
ruby-1.8.7-p358/lib/test/unit/ui/gtk/testrunner.rb: (Empty error message)
tar: Error exit delayed from previous errors.
Any idea how to fix? I've tried rvm get head, installing gcc-4.2 and using that, using clang, etc. But nothing seems to work.
Make sure to satisfy all requirements specified by:
rvm requirements
Including Xcode 4.1 or osx-gcc-installer
Run (to fix broken download):
rvm cleanup archives
and try again:
rvm reinstall 1.8.7
Is there any reason why you are going with 1.8.7? it's about at end of life and 1.9.3 should be used instead if this is not an requirement.

Trouble installing ruby with RVM. Database file does not exist?

Running into big problems at step one. I got RVM installed, then typed "rvm install 1.9.3" and here's the output:
David-Coles-MacBook-Air:~ DavesPiece$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/DavesPiece/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/DavesPiece/.rvm/src
Configuring yaml in /Users/DavesPiece/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/DavesPiece/.rvm/usr" ', please read /Users/DavesPiece/.rvm/log/ruby-1.9.3-p194/yaml/configure.log
Compiling yaml in /Users/DavesPiece/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/DavesPiece/.rvm/log/ruby-1.9.3-p194/yaml/make.log
Database file /Users/DavesPiece/.rvm/config/packages does not exist.
Installing Ruby from source to: /Users/DavesPiece/.rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)...
ruby-1.9.3-p194 - #fetching
ruby-1.9.3-p194 - #extracted to /Users/DavesPiece/.rvm/src/ruby-1.9.3-p194 (already extracted)
ruby-1.9.3-p194 - #configuring
Error running ' ./configure --prefix=/Users/DavesPiece/.rvm/rubies/ruby-1.9.3-p194 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/DavesPiece/.rvm/usr ', please read /Users/DavesPiece/.rvm/log/ruby-1.9.3-p194/configure.log
There has been an error while running configure. Halting the installation.
ls: /Users/DavesPiece/.rvm/rubies/*/bin/ruby: No such file or directory
David-Coles-MacBook-Air:~ DavesPiece$
I went and read the log files it mentioned but that lead nowhere. Any idea what I should do? I've practically Googled my face off and can't find a solution.
this looks suspicious, how did you installed RVM ?
the simplest solution is to:
touch /Users/DavesPiece/.rvm/config/packages
If you don't have Xcode, you'll need to install it. If you have Lion 10.7.3 or above you can find it in the App Store. Otherwise, you will need to go to the Apple Developer site (requires account) to find instructions for downloading and installing it.
Also, if you're on Lion, you may need to download and install GCC-10.7-v2.pkg. If you see a message about your compiler being LLVM based, you may need to use this command instead:
CC=/usr/bin/gcc-4.2 rvm install 1.9.2-p290 --enable-shared
Without having seen your configure.log this is just a best guess.
Can't install Ruby under Lion with RVM – GCC issues

ruby 1.9.2 installations error on rvm

I tried to install ruby 1.9.2 on rvm, but after the computer compiles for a while, the system says error message on Terminal. Do you know what the matter is? It's taking me hours :(
ruby-1.9.2-head - #fetching
HEAD is now at 91799a2 merges r30786, r30787 and r30797 from trunk into ruby_1_9_2.
From https://github.com/ruby/ruby
* branch ruby_1_9_2 -> FETCH_HEAD
Already up-to-date.
Copying from repo to src path...
Running autoconf
ruby-1.9.2-head - #configuring
ruby-1.9.2-head - #compiling
ERROR: Error running 'make ', please read /Users/nofear38/.rvm/log/ruby-1.9.2-head/make.log
ERROR: There has been an error while running make. Halting the installation.
Run rvm notes and ensure that OS dependencies are installed.
Do you have the build tools from XCode installed? You will need them if you want to make things.
The error output is specifically saying to read /Users/nofear38/.rvm/log/ruby-1.9.2-head/make.log. What does that log file tell you about the error? That might tell you exactly what the problem is.
If not, what command did you use when you installed RVM?
Are you following the Installation Methods or some other instructions? All too often we find people have either followed the wrong directions, didn't follow the directions completely, or are using the system-wide installation instead of the single-user's sandbox.
The command output you show is not what I see when installing Ruby via RVM for the current 1.9.2 install. If you used:
rvm install 1.9.2-head
I recommend instead you use:
rvm install 1.9.2
which will pull in 1.9.2-p180, which is the current stable branch, rather than the latest bleeding-edge version.
In case you haven't solved this problem, I'm running Ubuntu 11.0 and I used sudo apt-get install ruby-rvm and rvm installed perfectly!

Resources