Can't install Ruby 2.0.0 through RVM - ruby

I have inherited a legacy codebase that requires Ruby 2.0.0 to be installed with RVM. I am on Mac OS X Catalina, and the installer for Ruby 2.0.0 simply doesn't work.
Here is what my installation attempts look like, all the way from the installation of RVM itself up to the attempted Ruby 2.0.0 installation.
nbyrd$ \curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.10.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.10/1.29.10.tar.gz.asc
gpg: Signature made Wed Mar 25 14:58:42 2020 PDT
gpg: using RSA key 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski#gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
GPG verified '/Users/nbyrd/.rvm/archives/rvm-1.29.10.tgz'
Installing RVM to /Users/nbyrd/.rvm/
RVM PATH line found in /Users/nbyrd/.mkshrc.
RVM PATH line not found for Bash or Zsh, rerun this command with '--auto-dotfiles' flag to fix it.
RVM sourcing line found in /Users/nbyrd/.profile /Users/nbyrd/.bash_profile /Users/nbyrd/.zlogin.
Installation of RVM in /Users/nbyrd/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/nbyrd/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
nbyrd$ source ~/.profile
nbyrd$ rvm autolibs enable
nbyrd$ rvm install 2.0.0 --force
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.0.0-p648.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Installing requirements for osx.
Updating system.......
Installing required packages: openssl.
Updating certificates bundle '/usr/local/etc/openssl#1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/nbyrd/.rvm/rubies/ruby-2.0.0-p648, this may take a while depending on your cpu(s)...
ruby-2.0.0-p648 - #downloading ruby-2.0.0-p648, 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 10.2M 100 10.2M 0 0 18.2M 0 --:--:-- --:--:-- --:--:-- 18.2M
ruby-2.0.0-p648 - #extracting ruby-2.0.0-p648 to /Users/nbyrd/.rvm/src/ruby-2.0.0-p648.....
ruby-2.0.0-p648 - #applying patch /Users/nbyrd/.rvm/patches/ruby/2.0.0/openssl3.patch.
ruby-2.0.0-p648 - #applying patch /Users/nbyrd/.rvm/patches/ruby/2.0.0/update-autoconf.patch.
ruby-2.0.0-p648 - #configuring.................................................
ruby-2.0.0-p648 - #post-configuration.
ruby-2.0.0-p648 - #compiling......................
Error running '__rvm_make -j8',
please read /Users/nbyrd/.rvm/log/1605305278_ruby-2.0.0-p648/make.log
There has been an error while running make. Halting the installation.
And here is the contents of the "make.log" file referenced in the error message:
[2020-11-13 14:09:14] __rvm_make
__rvm_make ()
{
\make "$#" || return $?
}
current path: /Users/nbyrd/.rvm/src/ruby-2.0.0-p648
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/usr/local/sbin:/Users/nbyrd/.yarn/bin:/Users/nbyrd/.config/yarn/global/node_modules/.bin:/usr/local/sbin:/Users/nbyrd/.yarn/bin:/Users/nbyrd/.config/yarn/global/node_modules/.bin:/usr/local/sbin:/Users/nbyrd/.yarn/bin:/Users/nbyrd/.config/yarn/global/node_modules/.bin:/Users/nbyrd/.nvm/versions/node/v10.15.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/nbyrd/.rvm/bin
command(2): __rvm_make -j8
++ make -j8
CC = /usr/bin/clang
LD = ld
LDSHARED = /usr/bin/clang -dynamiclib
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl#1.1/include -I. -I.ext/include/x86_64-darwin19.6.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl#1.1/lib -install_name /Users/nbyrd/.rvm/rubies/ruby-2.0.0-p648/lib/libruby.2.0.0.dylib -current_version 2.0.0 -compatibility_version 2.0.0 -fstack-protector -Wl,-u,_objc_msgSend -fstack-protector -Wl,-u,_objc_msgSend
SOLIBS =
compiling main.c
compiling dmydln.c
compiling dmyencoding.c
compiling version.c
compiling miniprelude.c
translating probes probes.d
compiling bignum.c
compiling class.c
. ./vm_opts.h
compiling compar.c
compiling complex.c
compiling dir.c
compiling dln_find.c
compiling enum.c
complex.c:79:1: warning: unused function 'f_cmp' [-Wunused-function]
f_cmp(VALUE x, VALUE y)
^
complex.c:109:1: warning: unused function 'f_lt_p' [-Wunused-function]
f_lt_p(VALUE x, VALUE y)
^
complex.c:116:1: warning: unused function 'f_mod' [-Wunused-function]
binop(mod, '%')
^
complex.c:30:21: note: expanded from macro 'binop'
inline static VALUE \
^
<scratch space>:89:1: note: expanded from here
f_mod
^
complex.c:155:1: warning: unused function 'f_abs2' [-Wunused-function]
fun1(abs2)
^
complex.c:37:21: note: expanded from macro 'fun1'
inline static VALUE \
^
<scratch space>:92:1: note: expanded from here
f_abs2
^
complex.c:157:1: warning: unused function 'f_conj' [-Wunused-function]
fun1(conj)
^
complex.c:37:21: note: expanded from macro 'fun1'
inline static VALUE \
^
<scratch space>:96:1: note: expanded from here
f_conj
^
complex.c:159:1: warning: unused function 'f_floor' [-Wunused-function]
fun1(floor)
^
complex.c:37:21: note: expanded from macro 'fun1'
inline static VALUE \
^
<scratch space>:100:1: note: expanded from here
f_floor
^
complex.c:160:1: warning: unused function 'f_imag' [-Wunused-function]
fun1(imag)
^
complex.c:37:21: note: expanded from macro 'fun1'
inline static VALUE \
^
<scratch space>:102:1: note: expanded from here
f_imag
^
complex.c:164:1: warning: unused function 'f_real' [-Wunused-function]
fun1(real)
^
complex.c:37:21: note: expanded from macro 'fun1'
inline static VALUE \
^
<scratch space>:110:1: note: expanded from here
f_real
^
complex.c:185:1: warning: unused function 'f_divmod' [-Wunused-function]
fun2(divmod)
^
complex.c:44:21: note: expanded from macro 'fun2'
inline static VALUE \
^
<scratch space>:118:1: note: expanded from here
f_divmod
^
complex.c:197:1: warning: unused function 'f_idiv' [-Wunused-function]
fun2(idiv)
^
complex.c:44:21: note: expanded from macro 'fun2'
inline static VALUE \
^
<scratch space>:124:1: note: expanded from here
f_idiv
^
complex.c:263:1: warning: unused function 'k_integer_p' [-Wunused-function]
k_integer_p(VALUE x)
^
complex.c:465:1: warning: unused function 'f_complex_new1' [-Wunused-function]
f_complex_new1(VALUE klass, VALUE x)
^
complex.c:547:1: warning: unused function 'm_sqrt_bang' [-Wunused-function]
imp1(sqrt)
^
complex.c:518:21: note: expanded from macro 'imp1'
inline static VALUE \
^
<scratch space>:150:1: note: expanded from here
m_sqrt_bang
^
bignum.c:910:1: warning: unused function 'next_pow2' [-Wunused-function]
next_pow2(register unsigned long x)
^
compiling enumerator.c
compiling error.c
compiling eval.c
compiling load.c
compiling proc.c
compiling file.c
compiling gc.c
13 warnings generated.
compiling hash.c
compiling inits.c
compiling io.c
compiling marshal.c
compiling math.c
compiling node.c
compiling numeric.c
compiling object.c
compiling pack.c
compiling parse.c
compiling process.c
compiling random.c
compiling range.c
compiling rational.c
rational.c:86:1: warning: unused function 'f_gt_p' [-Wunused-function]
f_gt_p(VALUE x, VALUE y)
^
rational.c:136:1: warning: unused function 'f_floor' [-Wunused-function]
fun1(floor)
^
rational.c:40:21: note: expanded from macro 'fun1'
inline static VALUE \
^
<scratch space>:93:1: note: expanded from here
f_floor
^
rational.c:157:1: warning: unused function 'f_truncate' [-Wunused-function]
fun1(truncate)
^
rational.c:40:21: note: expanded from macro 'fun1'
inline static VALUE \
^
<scratch space>:103:1: note: expanded from here
f_truncate
^
rational.c:428:1: warning: unused function 'f_rational_new_bang2' [-Wunused-function]
f_rational_new_bang2(VALUE klass, VALUE x, VALUE y)
^
rational.c:537:1: warning: unused function 'f_rational_new1' [-Wunused-function]
f_rational_new1(VALUE klass, VALUE x)
^
rational.c:552:1: warning: unused function 'f_rational_new_no_reduce1' [-Wunused-function]
f_rational_new_no_reduce1(VALUE klass, VALUE x)
^
1 warning generated.
compiling re.c
compiling regcomp.c
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
compiling regsyntax.c
compiling ruby.c
6 warnings generated.
compiling safe.c
compiling signal.c
compiling sprintf.c
compiling st.c
compiling strftime.c
compiling string.c
compiling struct.c
compiling time.c
compiling transcode.c
compiling util.c
compiling variable.c
compiling compile.c
compiling debug.c
compiling iseq.c
compiling vm.c
compiling vm_dump.c
compiling vm_backtrace.c
compiling vm_trace.c
compiling thread.c
vm.c:1916:31: warning: expression does not compute the number of elements in this array; element type is 'int', not 'VALUE' (aka 'unsigned long') [-Wsizeof-array-div]
sizeof(th->machine_regs) / sizeof(VALUE));
~~~~~~~~~~~~~~~~ ^
vm.c:1916:31: note: place parentheses around the 'sizeof(VALUE)' expression to silence this warning
thread.c:977:27: warning: implicit conversion loses integer precision: 'long' to '__darwin_suseconds_t' (aka 'int') [-Wshorten-64-to-32]
tp->tv_usec = ts.tv_nsec / 1000;
~ ~~~~~~~~~~~^~~~~~
thread.c:4835:20: error: implicit declaration of function 'rb_frame_last_func' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
const ID mid = rb_frame_last_func();
^
thread.c:4835:20: note: did you mean 'rb_frame_this_func'?
./include/ruby/intern.h:369:4: note: 'rb_frame_this_func' declared here
ID rb_frame_this_func(void);
^
1 warning and 1 error generated.
make: *** [thread.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
++ return 2
I genuinely don't know what I can do to get past this error. I have never worked with Ruby before, but it looks like there is a function-call in its source code for which there is no function-declaration ("rb_frame_last_func").
I have tried multiple C-compilers and none of them have worked. I also tried getting help from the RVM developers, but they simply have not responded to my questions. RVM's website has no details on these errors. And I have browsed Stackoverflow and Google and tried dozens of alternative approaches: none of which have worked.
Can someone tell me what I am missing here?

This is due to a change in the behavior of tools included with Xcode 12:
Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)
https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes
You'll probably want to pass compile flags to RVM by setting them in your environment:
export optflags="-Wno-error=implicit-function-declaration"
Then you can retry:
$ rvm install 2.0.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.0.0-p648.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Installing requirements for osx.
Updating system - please wait
Installing required packages: openssl - please wait
Certificates bundle '/usr/local/etc/openssl#1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/foo/.rvm/rubies/ruby-2.0.0-p648, this may take a while depending on your cpu(s)...
ruby-2.0.0-p648 - #downloading ruby-2.0.0-p648, this may take a while depending on your connection...
ruby-2.0.0-p648 - #extracting ruby-2.0.0-p648 to /Users/foo/.rvm/src/ruby-2.0.0-p648 - please wait
ruby-2.0.0-p648 - #applying patch /Users/foo/.rvm/patches/ruby/2.0.0/openssl3.patch - please wait
ruby-2.0.0-p648 - #applying patch /Users/foo/.rvm/patches/ruby/2.0.0/update-autoconf.patch - please wait
ruby-2.0.0-p648 - #configuring - please wait
ruby-2.0.0-p648 - #post-configuration - please wait
ruby-2.0.0-p648 - #compiling - please wait
ruby-2.0.0-p648 - #installing - please wait
ruby-2.0.0-p648 - #making binaries executable - please wait
ruby-2.0.0-p648 - #downloading rubygems-3.0.8
ruby-2.0.0-p648 - #extracting rubygems-3.0.8 - please wait
ruby-2.0.0-p648 - #removing old rubygems - please wait
ruby-2.0.0-p648 - #installing rubygems-3.0.8 - please wait
Error running 'env GEM_HOME=/Users/foo/.rvm/gems/ruby-2.0.0-p648#global GEM_PATH= /Users/foo/.rvm/rubies/ruby-2.0.0-p648/bin/ruby -d /Users/foo/.rvm/src/rubygems-3.0.8/setup.rb --no-document',
please read /Users/foo/.rvm/log/1605308161_ruby-2.0.0-p648/rubygems.install.log
Despite the error at the end, Ruby does successfully compile and install:
$ rvm list
ruby-2.0.0-p648 [ x86_64 ]
ruby-2.5.7 [ x86_64 ]
=* ruby-2.7.1 [ x86_64 ]
ruby-3.0.0-preview1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ rvm use 2.0.0
rvm use 2.0.0
Using /Users/foo/.rvm/gems/ruby-2.0.0-p648
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-darwin19.6.0]
The same fix is probably needed for gems with native extensions:
gem install some_gem_name --with-cflags="-Wno-error=implicit-function-declaration"
Or for apps using bundler:
bundle config build.some_gem_name --with-cflags=\"-Wno-error=implicit-function-declaration\"

This has been fixed in RVM. Use
rvm get master
To get newest version of rvm and run rvm install again.
Here is the source: https://github.com/rvm/rvm/pull/4995

Related

How install crfsuite on Mac OS Monterey M1

brew install fails on M1 Mac with Monterey and Xcode installed for arm64 arch
tried various options to get it work, but didn't work those.
Other details:
cmake: 3.22.2
clang:
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
autoconf: 2.71
make: 3.81
arch: arm64
lingamoorthi.ankam#LingamorthysMBP ~ % brew install crfsuite
...
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../include -I. -I./include -mfpmath=sse -msse2 -DUSE_SSE -O3 -fomit-frame-pointer -ffast-math -Winline -std=c99 -c src/lookup3.c -fno-common -DPIC -o .libs/libcqdb_la-lookup3.o
error: unknown FP unit 'sse'
error: unknown FP unit 'sse'
make[1]: *** [libcqdb_la-cqdb.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [libcqdb_la-lookup3.lo] Error 1
make: *** [install-recursive] Error 1
lingamoorthi.ankam#LingamorthysMBP ~ %
also in the similar way liblbfgs(crfsuite dependency) also failed, but manually installing it succeeded.
All tools installed are uptodate.
lingamoorthi.ankam#LingamorthysMBP ~ % cmake --version
cmake version 3.22.2
...
lingamoorthi.ankam#LingamorthysMBP ~ % automake --version
automake (GNU automake) 1.16.5
...
lingamoorthi.ankam#LingamorthysMBP ~ % clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
lingamoorthi.ankam#LingamorthysMBP ~ % autoconf --version
autoconf (GNU Autoconf) 2.71
...
lingamoorthi.ankam#LingamorthysMBP ~ % make --version
...
This program built for i386-apple-darwin11.3.0
You might want to try to disable sse2
Here is a suggestion
brew install crfsuite
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and brewsci/science).
You have 6 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Downloading https://github.com/downloads/chokkan/crfsuite/crfsuite-0.12.tar.
Already downloaded: /Users/foo/Library/Caches/Homebrew/downloads/3b692f540345f335f203e8aa30a52e7279cba5d08e285130f811a02b565d8c46--crfsuite-0.12.tar.gz
==> Installing crfsuite from brewsci/science
==> ./configure --prefix=/opt/homebrew/Cellar/crfsuite/0.12
==> make install
...
error: unknown FP unit 'sse'
error: unknown FP unit 'sse'
make[1]: *** [libcqdb_la-cqdb.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [libcqdb_la-lookup3.lo] Error 1
make: *** [install-recursive] Error 1
Untar the downloaded crfsuite package
tar xvfz /Users/foo/Library/Caches/Homebrew/downloads/3b692f540345f335f203e8aa30a52e7279cba5d08e285130f811a02b565d8c46--crfsuite-0.12.tar.gz
Configure with disabled sse2 and other flags then make and install
cd crfsuite-0.12
./configure --prefix=$HOME/local --disable-shared --with-pic --disable-sse2
make
make install
Run ./configure --help to get details of parameters

Cannot install ruby with ASDF

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.

Error on installing ruby with jemalloc

I am on ubuntu 12.04.5 LTS and tried installing ruby with jemalloc. The jemalloc got installed successfully(https://blog.scalingo.com/2017/05/02/improve-ruby-application-memory-jemalloc.html) but while installing the ruby 2.3.4, it gave this following error.
>rvm install 2.3.4 -C --with-jemalloc
Warning, new version of rvm available '1.29.1', you are using older version '1.27.0'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
ruby-2.3.4 - #removing src/ruby-2.3.4..
Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /home/deploy/.rvm/rubies/ruby-2.3.4, this may take a while depending on your cpu(s)...
ruby-2.3.4 - #downloading ruby-2.3.4, this may take a while depending on your connection...
ruby-2.3.4 - #extracting ruby-2.3.4 to /home/deploy/.rvm/src/ruby-2.3.4....
ruby-2.3.4 - #configuring...........................................................
ruby-2.3.4 - #post-configuration..
ruby-2.3.4 - #compiling.....
Error running '__rvm_make -j2',
showing last 15 lines of /home/deploy/.rvm/log/1494486344_ruby-2.3.4/make.log
compiling enumerator.c
compiling error.c
compiling eval.c
eval.c: In function 'rb_raise_jump':
eval.c:763:8: warning: unused variable 'mid' [-Wunused-variable]
compiling load.c
compiling proc.c
compiling file.c
compiling gc.c
In file included from gc.c:50:0:
/usr/include/malloc.h:152:15: error: conflicting types for 'malloc_usable_size'
/usr/include/jemalloc/jemalloc.h:45:8: note: previous declaration of 'malloc_usable_size' was here
make: *** [gc.o] Error 1
make: *** Waiting for unfinished jobs....
++ return 2
There has been an error while running make. Halting the installation.
Has anyone encountered it before or may have the experience with it, please help.
On [xK]ubuntu 18.10
I did
sudo apt install libjemalloc-dev
rvm install 2.5.2 -C --with-jemalloc
rvm use 2.5.2
ruby -r rbconfig -e "puts RbConfig::CONFIG['LIBS']"
I use Ubuntu 18.04.
Change the command like this
RUBY_EXTRA_CONFIGURE_OPTIONS="--with-jemalloc" rvm install 2.3.4 --disable-binary
To check the jemalloc is installed, run the following command:
ruby -r rbconfig -e "puts RbConfig::CONFIG['LIBS']"
if the ruby is unrecognized after rvm is installed.
source ~/.rvm/scripts/rvm
When the jemalloc is called. You can see the response.
-lpthread -ljemalloc -ldl -lobjc
You can see the full documentation here
I ran across a variant of this issue when trying to get rails to use jemalloc. In my case I had (purposefully) installed system-wide rubies via rvm but forgotten to use rvmsudo like so:
$ sudo apt update; sudo apt install libjemalloc-dev -y
$ rvmsudo rvm reinstall 2.4.1 -C --with-jemalloc
If you're getting permissions warnings when trying to get jemalloc to work in an analogous scenario, give ^^^ a shot...

Why do gems with native extensions fail to build on Ubuntu?

I can run bundle install on my Mac without a problem, but when I run it on my Ubuntu build server it fails with the following output:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/var/lib/jenkins/.rvm/rubies/ruby-1.9.3-p385-dev/bin/ruby extconf.rb
creating Makefile
make
compiling native.c
native.c: In function ‘birch_edge_initialize’:
native.c:42:8: warning: unused variable ‘direction’ [-Wunused-variable]
native.c:41:8: warning: unused variable ‘directed’ [-Wunused-variable]
native.c:40:8: warning: unused variable ‘node_b’ [-Wunused-variable]
native.c:39:8: warning: unused variable ‘node_a’ [-Wunused-variable]
native.c:58:1: warning: control reaches end of non-void function [-Wreturn-type]
linking shared-object birch/native.so
make install
/usr/bin/install -c -m 0755 native.so /var/lib/jenkins/jobs
/usr/bin/install -c -m 0755 native.so .
/usr/bin/install: 'native.so' and './native.so' are the same file
make: *** [-] Error 1
I'm using RVM, ruby version ruby-1.9.3-p385-dev.
The problem isn't specific to one gem either - removing birch results in the same type of error for bson with native extensions.
It seems this was caused by a bad RVM install. I initially installed rvm using apt (bad, bad idea), and it looks like the purge didn't clean everything up. Setting up a clean ec2 instance with a clean rvm install fixed it

Error when installing Ruby 1.9.3 on Mac OS X Lion

I'm trying to install Ruby 1.9.3 and Rails on MAC OS X Lion. (My Xcode is version 4.3)
(I've installed Rails 3.2.2)
No matter if I use:
rvm install 1.9.3 --with-gcc=clang
or:
rvm install 1.9.3
My terminal shows:
Error running 'make ', please read /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
There has been an error while running make. Halting the installation.
Has anyone encountered the same situation?
AlexHo#Nien-Yi-Hos-MacBook:~$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/AlexHo/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/AlexHo/.rvm/src
Configuring yaml in /Users/AlexHo/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/AlexHo/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/AlexHo/.rvm/usr
Installing Ruby from source to: /Users/AlexHo/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /Users/AlexHo/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
ruby-1.9.3-p125 - #compiling
Error running 'make ', please read /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
There has been an error while running make. Halting the installation.
AlexHo#Nien-Yi-Hos-MacBook:~$ cat /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
[2012-03-03 04:15:53] make
CC = clang
LD = ld
LDSHARED = clang -dynamiclib
CFLAGS = -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I. -I.ext/include/x86_64-darwin11.3.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/AlexHo/.rvm/rubies/ruby-1.9.3-p125/lib/libruby.1.9.1.dylib -current_version 1.9.1 -compatibility_version 1.9.1 -Wl,-unexported_symbol,_Init_* -Wl,-unexported_symbol,*_threadptr_* -Wl,-u,_objc_msgSend
SOLIBS =
linking miniruby
rbconfig.rb unchanged
generating enc.mk
generating prelude.c
compiling prelude.c
linking static-library libruby.1.9.1-static.a
linking shared-library libruby.1.9.1.dylib
generating encdb.h
encdb.h unchanged
making enc
make[1]: Nothing to be done for `enc'.
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
installing default bug libraries
installing default resize libraries
installing default bug libraries
installing default bug libraries
installing default funcall libraries
installing default dot.dot libraries
installing default old_thread_select libraries
installing default numhash libraries
installing default string libraries
installing default wait_for_single_fd libraries
installing default bigdecimal libraries
installing default continuation libraries
installing default coverage libraries
installing default curses libraries
installing default date_core libraries
make[2]: Nothing to be done for `all'.
installing digest libraries
installing default digest libraries
installing default bubblebabble libraries
installing default md5 libraries
installing default rmd160 libraries
installing default sha1 libraries
installing default sha2 libraries
installing dl libraries
installing default dl libraries
installing default callback libraries
make[2]: Nothing to be done for `all'.
installing default etc libraries
installing default fcntl libraries
installing default fiber libraries
installing default fiddle libraries
make[2]: Nothing to be done for `all'.
installing default iconv libraries
installing default console libraries
installing default nonblock libraries
installing default wait libraries
installing default libraries
installing default generator libraries
installing default parser libraries
installing default complex libraries
installing default rational libraries
installing default nkf libraries
installing default objspace libraries
installing default openssl libraries
installing default pathname libraries
installing default psych libraries
installing default pty libraries
installing default cparse libraries
compiling readline.c
readline.c:1499:9: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
rl_username_completion_function);
^
readline.c:69:42: note: instantiated from:
# define rl_username_completion_function username_completion_function
^
/usr/local/include/readline/readline.h:449:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
^
1 error generated.
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make: *** [build-ext] Error 2
I had this problem myself, and after a great deal of struggle and searching (not one site had the complete solution), here's what I finally came up with:
curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
tar xzvf readline-6.2.tar.gz
cd readline-6.2
./configure --prefix=/usr/local
cd shlib
sed -e 's/-dynamic/-dynamiclib/' Makefile > Makefile.good
mv Makefile.good Makefile
cd ..
make
sudo make install
cd ..
rvm install 1.9.3 -C --with-readline-dir=/usr/local/
Try looking at this, it seems that your problem is with readline, and rvm has a whole section about working with readline errors.
http://rvm.io/packages/readline/

Resources