我在Windows Vista 64位操作系统上运行。 Geografikos是杰里米·威特默(Jeremy Witmer)创建的硕士论文项目。它全部用JRuby编码。我目前正在他的指导下扩展该项目,但我无法运行他的程序。已安装以下宝石:
C:\work\Code\geografikos>jruby -S gem list
*** LOCAL GEMS ***
actionmailer (2.3.3)
actionpack (2.3.3)
activerecord (2.3.3)
activerecord-jdbc-adapter (0.9.1)
activerecord-jdbcmysql-adapter (0.9.1)
activeresource (2.3.3)
activesupport (2.3.3)
gchart (1.0.0)
google-geocode (1.2.1)
hoe (2.3.3)
hpricot (0.6.161)
jdbc-mysql (5.0.4)
jruby-openssl (0.5.1)
minitest (1.4.2)
nokogiri (1.3.3)
rack (1.0.0)
rails (2.3.3)
rake (0.8.7)
rc-rest (3.0.0)
rdoc (2.4.3)
rspec (1.2.6)
rubyforge (1.0.4)
rubygems-update (1.3.5)
sources (0.0.1)
geografikos.rb需要以下宝石:
%w(rubygems digest/sha1 digest/md5 active_record hpricot yaml open-uri ostruct java google_geocode gchart active_record/fixtures).each{|f| require f}
当我需要或运行geografikos.rb时出现以下错误:
C:\work\Code\geografikos>jirb
irb(main):001:0> require 'geografikos'
LoadError: Could not open any of [xml2, xslt, exslt]
from C:/jruby-1.3.1/bin/../lib/ruby/1.8/ffi/library.rb:18:in `ffi_lib'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri/ffi/libxml.rb:5
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri/ffi/libxml.rb:31:in `require'
from C:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in
'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri.rb:10
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri.rb:31:in `require'
from C:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in
'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/rc-rest-3.0.0/lib/rc_rest.rb:3
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/rc-rest-3.0.0/lib/rc_rest.rb:31:in `require'
from C:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in
'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/google-geocode-1.2.1/lib/google_geocode.rb:2
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/google-geocode-1.2.1/lib/google_geocode.rb:36:in `require'
from C:/jruby-1.3.1/bin/../lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in
'
from C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
from geografikos.rb:304
from geografikos.rb:304:in `each'
from geografikos.rb:304
from geografikos.rb:2:in `require'
from (irb):2irb(main):002:0>
我觉得我需要安装xml,xml2,xslt和exslt库,但是当我尝试安装这些库时出现错误,如下所示:
C:\work\Code\geografikos>jruby -S gem install libxml-ruby
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
C:/jruby-1.3.1/bin/../bin/jruby.bat extconf.rb
C:/jruby-1.3.1/bin/../lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (No
tImplementedError)
from C:/jruby-1.3.1/bin/../lib/ruby/1.8/mkmf.rb:14:in `require'
from extconf.rb:14
Gem files will remain installed in C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.3 for inspection.
Results logged to C:/jruby-1.3.1/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.3/ext/libxml/gem_make.out
如果您需要任何其他信息,请与我们联系。我无法解决这个问题!
答案 0 :(得分:2)
看来这些宝石是“原生地”实施的;也就是说,用低级语言而不是直接用Ruby语言。 JRuby不支持具有本机扩展的gem,因为它无法在JVM中运行它们。