Home > Enterprise >  Ruby 2.2.1 is failing on install on mac
Ruby 2.2.1 is failing on install on mac

Time:08-15

I have an older app that I constructed with ruby 2.2.1 I know it is past EOL but I need to get the app running so I can upgrade it. I am installing with rbenv but when I install I get this error.

Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/arthurveal/.rbenv/versions/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 (macOS 12.5 using ruby-build 20220726)

Inspect or clean up the working tree at /var/folders/c_/vydvf3y11v10dzyyp87nqrw40000gn/T/ruby-build.20220813181950.74610.xtMp6B
Results logged to /var/folders/c_/vydvf3y11v10dzyyp87nqrw40000gn/T/ruby-build.20220813181950.74610.log

Last 10 log lines:
    rb_ivar_set(enumerator, rb_intern("slicewhen_pred"), pred);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1475:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
28 warnings generated.
6 warnings generated.
6 warnings generated.
52 warnings generated.
20 warnings generated.

Here is the full error log. I am looking for an option to allow this ruby version to run.

Here is the full error log.

CodePudding user response:

The offending error in the full log seems to be

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);                               

which seems similar to what was discussed in https://github.com/rbenv/ruby-build/discussions/1854 and https://github.com/rbenv/ruby-build/issues/1489 .

In that case, this might help:

CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.2.1
  • Related