Jruby - 无法安装 Mongo gem
Jruby - cannot install Mongo gem
JRuby 9.1.12.0 (2.3.3)
红宝石宝石 2.6.11
赢7
Mongo2.3.2
Bson-4.2.2
我已经转移到 JRuby 以使我能够使用一些基于 Java 的库,并且我已经设法安装了我所有的原始 gem cucumber/Rspec/Watir 等,但我似乎无法安装 Mongo Gem。我收到以下错误消息:
C:\Ruby\gem>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
您正在尝试使用依赖于 JRuby 中的本机扩展的 MRI gem - 这不会(很容易)起作用。
您的选择是:
- 找到一个不依赖于本机扩展的纯ruby mongo 驱动程序
- 找到一个 java mongodb 驱动程序,您可以将其包装在 ruby 代码中并作为依赖项加载到您的 jruby 应用程序中
这应该有用,也许做一个干净的 bundle install
...以便您安装最新的 gems :
$ 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 9.1.12.0 (2.3.3) 红宝石宝石 2.6.11 赢7 Mongo2.3.2 Bson-4.2.2
我已经转移到 JRuby 以使我能够使用一些基于 Java 的库,并且我已经设法安装了我所有的原始 gem cucumber/Rspec/Watir 等,但我似乎无法安装 Mongo Gem。我收到以下错误消息:
C:\Ruby\gem>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
您正在尝试使用依赖于 JRuby 中的本机扩展的 MRI gem - 这不会(很容易)起作用。
您的选择是:
- 找到一个不依赖于本机扩展的纯ruby mongo 驱动程序
- 找到一个 java mongodb 驱动程序,您可以将其包装在 ruby 代码中并作为依赖项加载到您的 jruby 应用程序中
这应该有用,也许做一个干净的 bundle install
...以便您安装最新的 gems :
$ 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]