我在RHEL 6 / x86-64上安装了ruby-2.4.4:
$ tar Jxf ruby-2.4.4.tar.xz
$ cd ruby-2.4.4
$ ./configure LDFLAGS=-Wl,-rpath,/tmp/ruby24/lib \
--enable-shared --with-mantype=man \
--disable-rpath --disable-dtrace --enable-install-doc \
--with-sitedir=/tmp/ruby24p/lib \
--with-vendordir=/tmp/ruby24p/vendor/lib \
--datadir=/tmp/ruby24/share --datarootdir=/tmp/ruby24/share \
--prefix=/tmp/ruby24
...
$ make
$ make install
我想安装bones-3.8.4.gem。首先,我安装了loquacious依赖:
$ /tmp/ruby24/bin/gem install --local -V --document \
--bindir=/tmp/ruby24p/bin \
--install-dir=/tmp/ruby24p/vendor/lib/2.4.0 loquacious-1.9.1.gem
然后我尝试安装bones-3.8.4.gem:
$ /tmp/ruby24/bin/gem install --local -V --document \
--bindir=/tmp/ruby24p/bin \
--install-dir=/tmp/ruby24p/vendor/lib/2.4.0 bones-3.8.4.gem
ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository
$ /tmp/ruby24/bin/gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.2)
did_you_mean (1.1.0)
io-console (default: 0.4.6)
json (default: 2.0.4)
minitest (5.10.1)
net-telnet (0.1.1)
openssl (default: 2.0.7)
power_assert (0.4.1)
psych (default: 2.2.2)
rake (12.0.0)
rdoc (default: 5.0.0)
test-unit (3.2.3)
xmlrpc (0.2.1)
" gem list
"?为什么不会喋喋不休?这就是为什么安装骨头找不到啰嗦?
$ cd /tmp/ruby24p
$ find . | sort
.
./lib
./lib/2.4.0
./lib/2.4.0/x86_64-linux
./vendor
./vendor/lib
./vendor/lib/2.4.0
./vendor/lib/2.4.0/build_info
./vendor/lib/2.4.0/cache
./vendor/lib/2.4.0/cache/loquacious-1.9.1.gem
./vendor/lib/2.4.0/doc
./vendor/lib/2.4.0/extensions
./vendor/lib/2.4.0/gems
./vendor/lib/2.4.0/gems/loquacious-1.9.1
./vendor/lib/2.4.0/gems/loquacious-1.9.1/...
./vendor/lib/2.4.0/specifications
./vendor/lib/2.4.0/specifications/loquacious-1.9.1.gemspec
./vendor/lib/2.4.0/x86_64-linux
但是,即使我设置了GEM_PATH,安装仍然会失败:
$ GEM_PATH=/tmp/ruby24p/vendor/lib/2.4.0 /tmp/ruby24/bin/gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.2)
did_you_mean (1.1.0)
io-console (default: 0.4.6)
json (default: 2.0.4)
little-plugger (1.1.4)
loquacious (1.9.1)
minitest (5.10.1)
net-telnet (0.1.1)
openssl (default: 2.0.7)
power_assert (0.4.1)
psych (default: 2.2.2)
rake (12.0.0)
rdoc (default: 5.0.0)
test-unit (3.2.3)
xmlrpc (0.2.1)
$ GEM_PATH=/tmp/ruby24p/vendor/lib/2.4.0 /tmp/ruby24/bin/gem \
install --local -V --document --bindir=/tmp/ruby24p/bin \
--install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
/opt/src/2018.01.01/ruby/bones-3.8.4/src/bones-3.8.4.gem
ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository
我还尝试使用Ruby版本2.0.0-p648,2.1.10,2.2.10,2.3.7和2.5.1,只有2.0.0-p648能够成功找到依赖项(无需设置) GEM_PATH)。