JRuby 9.1.12.0 (2.3.3( 红宝石 2.6.11 赢 7 蒙戈 2.3.2 布森-4.2.2
我已经转移到JRuby,使我能够使用一些基于Java的库,我已经设法安装了我所有的原始宝石黄瓜/Rspec/Watir等,但我似乎无法安装Mongo Gem。我收到以下错误消息:
C:Rubygem>jruby -S gem install mongo
Building native extensions. This could take a while...
C:/jruby-9.1.12.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:58: warning: Tempfile#unlink or delete called on open file
; ignoring
ERROR: Error installing mongo:
ERROR: Failed to build gem native extension.
current directory: C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bson-4.2.2/ext/bson
C:/jruby-9.1.12.0/bin/jruby.exe -r ./siteconf20170719-4116-mhpj6s.rb extconf.rb
creating Makefile
current directory: C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bson-4.2.2/ext/bson
make "DESTDIR=" clean
current directory: C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bson-4.2.2/ext/bson
make "DESTDIR="
make: *** No rule to make target `C:/jruby-9.1.12.0/lib/ruby/include/ruby/ruby.h', needed by `bson_native.o'. Stop.
make failed, exit code 2
Gem files will remain installed in C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bson-4.2.2 for inspection.
Results logged to C:/jruby-9.1.12.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/bson-4.2.2/gem_make.out
这应该有效,也许做一个干净的bundle install
...以便您安装最新的 gem :
$ jruby -S gem install mongo
Fetching: bson-4.2.2-java.gem (100%)
Successfully installed bson-4.2.2-java
Fetching: mongo-2.4.2.gem (100%)
Successfully installed mongo-2.4.2
2 gems installed
#
$ jruby -v
jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [linux-x86_64]
您正在尝试使用依赖于 JRuby 中本机扩展的 MRI gem - 这不会(很容易(起作用。
您的选择是:
- 查找不依赖于本机扩展的纯 Ruby MONGO 驱动程序
- 找到一个Java MongoDB驱动程序,你可以用Ruby代码包装并作为依赖项加载到你的jruby应用程序中