ruby-build: Cannot load such file -- optparse (LoadError)
Hi guys, anyone encountered this issue while installing 2.7.1?
$ rbenv install 2.7.1
Downloading ruby-2.7.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
Installing ruby-2.7.1...
BUILD FAILED (Pop 20.04 using ruby-build 20200224-73-g0a5e059)
Inspect or clean up the working tree at /tmp/ruby-build.20200821113417.841610.nXIFsy
Results logged to /tmp/ruby-build.20200821113417.841610.log
Last 10 log lines:
LC_CTYPE =
MFLAGS =
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
./tool/file2lastrev.rb:6:in `require': cannot load such file -- optparse (LoadError)
from ./tool/file2lastrev.rb:6:in `<main>'
make: *** [uncommon.mk:1130: revision.tmp] Error 1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 20 (7 by maintainers)
fixed this by uninstall rbenv and reinstall with homebrew for ubuntu
I met same issue on Ubuntu 21.04 amd64.
I used system ruby instead of ruby-build’s ruby 😅
refs: ruby-buildでRubyをインストールしようとしたらoptparseが無いって言われる - ser1zw’s blog
@mislav Finally I install 3.0.1 success as following step
I’m facing the same issue with
2.7.0
inVoid Linux x86_64
.My solution, based on previous comments, was to set
RUBY_CONFIGURE_OPTS
to indicate the “BASERUBY” (which I don’t know what it means) and then install as usual:From the log, when
rbenv install 2.7.0
fails, I can see the next message:And notice that
ruby 2.7.4p191
is system:Now, reading https://github.com/ruby/ruby/blob/master/configure.ac#L50 makes me wonder if a previous version of Ruby is needed to build Ruby
>= 2.7.0
?: “executable host ruby is required. use--with-baseruby
option”.Whats your opinion? 🤔
https://github.com/rbenv/ruby-build/issues/1484#issuecomment-814918917 is a strange behavior for me. Because I never faced that with my macOS and linux boxes.
I try to reproduce it.