rvm / rvm

Ruby enVironment Manager (RVM)
https://rvm.io
Other
5.12k stars 1.03k forks source link

Cannot install Ruby 2.7.4 and 3.0.2 on Mac - NoMethodError - Nil #5124

Open Pr0p1k opened 3 years ago

Pr0p1k commented 3 years ago

I am running bash script inside Mac OS X 10.14 virtual machine. The setup is clean, I get the latest gnupg, then do

xcode-select --install
sudo xcodebuild -license accept

brew install gcc cmake openssl readline libyaml sqlite3 libxml2 libxslt \
    nodejs mysql rsync rsyslog gdbm ncurses pkg-config libice libpthread-stubs libsm libx11 \
    libxau libxcb libxdmcp libxt xtrans yarn
brew link readline

echo "export rvm_pretty_print_flag=0" >> ~/.rvmrc
source ~/.profile
source ~/.rvm/scripts/rvm
rvm get head
rvm use system
rvm install ruby-2.1.10
rvm install ruby-2.2.10
rmv install ruby-2.3.8
rvm install ruby-2.4.6
rvm install ruby-2.5.5
rvm install ruby-2.6.3
rvm install jruby-9.2.6
# try to install with openssl from brew https://github.com/rvm/rvm/issues/4697
rvm install 2.7 --with-openssl-dir=`brew --prefix openssl`
rvm install 3.0.2 --with-openssl-dir=`brew --prefix openssl`

All other rubies are installed successfully. As you can see, I already tried custom openssl dir - it doesn't help.

Both 2.7.4 and 3.0.2 produce the following

Error running '__rvm_make -j1',
please read /Users/builduser/.rvm/log/1628619020_ruby-3.0.2/make.log

There has been an error while running make. Halting the installation

Here are the contents of make.log:

[2021-08-10 21:03:48] __rvm_make
__rvm_make () 
{ 
    \make "$@" || return $?
}
current path: /Users/builduser/.rvm/src/ruby-2.7.4
GEM_HOME=/Users/builduser/.rvm/gems/jruby-9.2.6.0
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:/Users/builduser/.rvm/gems/jruby-9.2.6.0/bin:/Users/builduser/.rvm/gems/jruby-9.2.6.0@global/bin:/Users/builduser/.rvm/rubies/jruby-9.2.6.0/bin:/Users/builduser/.rvm/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
GEM_PATH=/Users/builduser/.rvm/gems/jruby-9.2.6.0:/Users/builduser/.rvm/gems/jruby-9.2.6.0@global
command(2): __rvm_make -j1
++ make -j1
    BASERUBY = /Users/builduser/.rvm/rubies/jruby-9.2.6.0/bin/ruby --disable=gems
    CC = gcc
    LD = ld
    LDSHARED = gcc -dynamiclib
    CFLAGS = -g -O2 -fno-common -pipe 
    XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-darwin18 -I./include -I. -I./enc/unicode/12.1.0
    CPPFLAGS = -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 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   
    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/builduser/.rvm/rubies/ruby-2.7.4/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.4  -fstack-protector-strong -framework Security -framework Foundation  -fstack-protector-strong -framework Security -framework Foundation  
    SOLIBS = -lpthread -lgmp -ldl -lobjc
    LANG = 
    LC_ALL = 
    LC_CTYPE = 
    MFLAGS = 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode_11.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
translating probes probes.d
. ./vm_opts.h
compiling array.c
array.c:290:17: warning: expression result unused [-Wunused-value]
                RB_OBJ_WRITE(buff_owner_ary, &ptr[i+beg], argv[i]);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./internal.h:2705:34: note: expanded from macro 'RB_OBJ_WRITE'
#define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./internal.h:2697:5: note: expanded from macro 'UNALIGNED_MEMBER_ACCESS'
    unaligned_member_access_result; \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1087:5: note: expanded from macro 'RARRAY_PTR_USE_TRANSIENT'
    expr; \
    ^~~~
array.c:1200:2: warning: expression result unused [-Wunused-value]
        RB_OBJ_WRITE(target_ary, &ptr[idx], item);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./internal.h:2705:34: note: expanded from macro 'RB_OBJ_WRITE'
#define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./internal.h:2697:5: note: expanded from macro 'UNALIGNED_MEMBER_ACCESS'
    unaligned_member_access_result; \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/ruby/ruby.h:1087:5: note: expanded from macro 'RARRAY_PTR_USE_TRANSIENT'
    expr; \
    ^~~~
2 warnings generated.
compiling ast.c
compiling bignum.c
compiling class.c
compiling compar.c
compiling compile.c
compiling complex.c
compiling cont.c
compiling debug.c
compiling debug_counter.c
compiling dir.c
compiling dln_find.c
compiling encoding.c
compiling enum.c
compiling enumerator.c
compiling error.c
compiling eval.c
compiling file.c
compiling gc.c
compiling hash.c
compiling inits.c
compiling io.c
compiling iseq.c
compiling load.c
compiling marshal.c
compiling math.c
making mjit_config.h
compiling mjit.c
compiling mjit_compile.c
compiling node.c
compiling numeric.c
compiling object.c
compiling pack.c
compiling parse.c
compiling proc.c
compiling process.c
compiling random.c
compiling range.c
compiling rational.c
compiling re.c
compiling regcomp.c
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
compiling regsyntax.c
compiling ruby.c
compiling safe.c
compiling signal.c
compiling sprintf.c
compiling st.c
compiling strftime.c
compiling string.c
compiling struct.c
compiling symbol.c
compiling thread.c
compiling time.c
compiling transcode.c
compiling transient_heap.c
compiling util.c
compiling variable.c
./revision.h unchanged
compiling version.c
compiling vm.c
compiling vm_backtrace.c
compiling vm_dump.c
compiling vm_trace.c
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
generating encdb.h
encdb.h updated
NoMethodError: undefined method `empty?' for nil:NilClass
  <main> at -e:2
make: *** [.rbconfig.time] Error 1
++ return 2

I have no idea how to fix it and haven't found the same problem anywhere.

Pr0p1k commented 3 years ago

Tried to run

rvm install 2.7.0
rvm install 3.0.0

The same error happens

Pr0p1k commented 3 years ago

Tried to run

rvm install 2.7.4 --with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --with-libyaml-dir=`brew --prefix libyaml` --with-gdbm-dir=`brew --prefix gdbm`
rvm install 3.0.2 --with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --with-libyaml-dir=`brew --prefix libyaml` --with-gdbm-dir=`brew --prefix gdbm`

it succeeded, but then I got back previous installations, so:

rvm install ruby-2.1.10
rvm install ruby-2.2.10
rmv install ruby-2.3.8
rvm install ruby-2.4.6
rvm install ruby-2.5.5
rvm install ruby-2.6.3
rvm install jruby-9.2.6
rvm install 2.7.4 --with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --with-libyaml-dir=`brew --prefix libyaml` --with-gdbm-dir=`brew --prefix gdbm`
rvm install 3.0.2 --with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --with-libyaml-dir=`brew --prefix libyaml` --with-gdbm-dir=`brew --prefix gdbm`

And it failed again. What could be the cause?

patmifsud commented 3 years ago

Was this ever resolved? Having the same issue

MFQ commented 3 years ago

I am also getting same issue

shclarke007 commented 3 years ago

Trying to install 2.7.4 and getting the same issue. Did anyone figure out what is happening?

jonathanroehm commented 3 years ago

I am also having this issue! I've tried the path of updating rvm, removing and reinstalling xcode, ensuring homebrew openssl is working, etc.

ZASMan commented 2 years ago

Anyone have an update on this? Having the problem on Mac Monterey with 2.5.7.

ghost commented 2 years ago

I'm having a similar issue trying to rvm install ruby-3.1.0 on OS X BigSur 11.6.2

Console:

% rvm install ruby-3.1.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/11.6/x86_64/ruby-3.1.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating certificates bundle '/usr/local/etc/openssl@1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: ~/.rvm/rubies/ruby-3.1.0, this may take a while depending on your cpu(s)...
ruby-3.1.0 - #downloading ruby-3.1.0, 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 19.1M  100 19.1M    0     0   562k      0  0:00:34  0:00:34 --:--:--  572k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-3.1.0 - #extracting ruby-3.1.0 to ~/.rvm/src/ruby-3.1.0 - please wait
ruby-3.1.0 - #configuring - please wait
ruby-3.1.0 - #post-configuration - please wait
ruby-3.1.0 - #compiling - please wait
Error running '__rvm_make -j16',
please read ~/.rvm/log/1643664059_ruby-3.1.0/make.log

There has been an error while running make. Halting the installation.

~/.rvm/log/1643664059_ruby-3.1.0/make.log:

...

linking miniruby
generating encdb.h
encdb.h updated
builtin_binary.inc updated
compiling builtin.c
NoMethodError: undefined method `empty?' for nil:NilClass
  -e at -e:2
make: *** [.rbconfig.time] Error 1
+__rvm_make:0> return 2

Would appreciate any advice on how to resolve this -- thanks!

shclarke007 commented 2 years ago

I just got rid of rvm from my system and started using rbenv

emadb commented 2 years ago

Same error here:

Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/ema/.rvm/rubies/ruby-2.4.4, this may take a while depending on your cpu(s)...
ruby-2.4.4 - #downloading ruby-2.4.4, this may take a while depending on your connection...
ruby-2.4.4 - #extracting ruby-2.4.4 to /Users/ema/.rvm/src/ruby-2.4.4 - please wait
ruby-2.4.4 - #configuring - please wait
ruby-2.4.4 - #post-configuration - please wait
ruby-2.4.4 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/ema/.rvm/log/1645722899_ruby-2.4.4/make.log

There has been an error while running make. Halting the installation.

On Mac OS 12.2.1

rubycoder commented 2 years ago

I've been having this same issue, trying to use rvm to install ruby 3.0.x on a Monterey 2018 Mac mini. Then I realized that my current ruby was jruby-9.2.9.0. I set it to ruby-2.7.6 and now 3.0.4 installs without any issues.

keegangroth commented 2 years ago

I was able to fix this by completely removing and reinstalling rvm using the "How do I completely clean out all traces of RVM from my system, including for system wide installs?" section of https://rvm.io/support/troubleshooting. Upgrading with rvm get stable did not work.

rubycoder commented 2 years ago

Thank you for the information. I think my problem was related to jruby. Does it work for you if the current Ruby in RVM is a jruby version and you then try to install an MRI Ruby?

keegangroth commented 2 years ago

Indeed, even reinstalled, I cannot install Ruby 3 with Jruby active. I was fairly sure I couldn't install it either way before though. (Perhaps worth noting that I've had trouble updating other things like rubygems on certain Jruby configs)

Unknown-Guy commented 2 years ago

Only had JRubies on Centos, had to run rvm use system before installing CRuby.

BSamim commented 1 year ago
brew update cmake
rvm cleanup all
rvm get stable
brew remove openssl@1.1
brew install openssl@1.1
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

Try running these commands. I was getting the same issue get rid of it by running these.

demyinn00 commented 1 year ago

I'm getting these same issues. I've tried rvm and rbenv. I'm trying to install 2.7.4. I'm using an apple silicon chip so i made sure to update rosetta, but that still didn't work. Not too sure why this is happening

rubycoder commented 1 year ago

This may not be the answer you're looking for, but I gave up on the other solutions and tried chruby. It works perfectly installing 2.7.8, 3.1.4 and 3.2.2 (and, FWIW, JRuby also) on a mini M2 Pro running Ventura 13.4.1.

Good luck!

On Tue, Nov 7, 2023 at 8:18 PM David Em-Yinn @.***> wrote:

I'm getting these same issues. I've tried rvm and rbenv. I'm trying to install 2.7.4. I'm using an apple silicon chip so i made sure to update rosetta, but that still didn't work. Not too sure why this is happening

— Reply to this email directly, view it on GitHub https://github.com/rvm/rvm/issues/5124#issuecomment-1801057639, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKW4SGNSHEL3MUDUDWKYDYDMBXPAVCNFSM5B47YPG2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBQGEYDKNZWGM4Q . You are receiving this because you commented.Message ID: @.***>

mathieujobin commented 1 year ago

I assume you already fix the typo in rmv install ruby-2.3.8

if rvm install 2.7 gets you 2.7.4, then your rvm is outdated you should do rvm get master early in that script.

when installing any ruby versionned x.y.z, you should always get the latest z

so 2.7.8 should be the only 2.7 you think about.