无法在vbox中的solaris上打开运行bundle exec rspec的库'libkernel32.so'

时间:2012-10-24 16:52:57

标签: ruby-on-rails rspec solaris

设定:

主机是运行Windows 7,64位的笔记本电脑

Guest是使用软件包在VirtualBox 4.2上运行的Solaris 11:

  • 红宝石(1.9.3p286)
  • rails(3.2.8)
  • 宝石(1.8.24)
  • bundler(1.2.1)
  • git(1.7.3.2)

经过一些小小的推文后,一切似乎都运行良好。我正在阅读Michael Hartl撰写的Ruby on Rails教程,并创建了一个基本的网页。我提出了rails服务器,可以显示网页。基本的git命令似乎工作正常。

运行rspec以启动基本测试阶段并获得以下内容:

  

/usr/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/lib/ffi/library.rb:121:在'ffi_lib'块中:

     

无法打开库'kernel32':ld.so.1:ruby:致命:kernel32:open failed:没有这样的文件或目录。 (LoadError)

     

无法打开库'libkernel32.so':ld.so.1:ruby:fatal:libkernel32.so:open failed:没有这样的文件或目录。

对不起,这里没有回溯,但导致问题的行似乎来自:

..../1.9.1/gems/ffi-1.1.5/lib/ffi/library.rb:88:in 'map'

搜索了guest虚拟机和主机,但找不到libkernel32。可以在互联网上找不到任何关于kernel32的内容。所有ruby on rails功能在Windows主机上都能正常工作。在solaris上尝试这个,我知道我会遇到问题并希望能够解决问题。 rspec的这个问题,我似乎完全卡住了,不知道哪种方式继续下去。

    $ bundle exec rspec
    /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'kernel32': ld.so.1: ruby: fatal: kernel32: open failed: No such file or directory. (LoadError)
    Could not open library 'libkernel32.so': ld.so.1: ruby: fatal: libkernel32.so: open failed: No such file or directory
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/lib/ffi/library.rb:88:in `map'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/lib/ffi/library.rb:88:in `ffi_lib'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rb-fchange-0.0.5/lib/rb-fchange/native.rb:10:in `<module:Native>'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rb-fchange-0.0.5/lib/rb-fchange/native.rb:8:in `<module:FChange>'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rb-fchange-0.0.5/lib/rb-fchange/native.rb:3:in `<top (required)>'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rb-fchange-0.0.5/lib/rb-fchange.rb:1:in `require'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rb-fchange-0.0.5/lib/rb-fchange.rb:1:in `<top (required)>'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:73:in `require'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:73:in `block (2 levels) in require'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:71:in `each'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:71:in `block in require'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
        from /home/t103339/rails-projects/sample_app-solaris/config/application.rb:13:in `<top (required)>'
        from /home/t103339/rails-projects/sample_app-solaris/config/environment.rb:2:in `require'
        from /home/t103339/rails-projects/sample_app-solaris/config/environment.rb:2:in `<top (required)>'
        from /home/t103339/rails-projects/sample_app-solaris/spec/spec_helper.rb:3:in `require'
        from /home/t103339/rails-projects/sample_app-solaris/spec/spec_helper.rb:3:in `<top (required)>'
        from /home/t103339/rails-projects/sample_app-solaris/spec/requests/static_pages_tests_spec.rb:1:in `require'
        from /home/t103339/rails-projects/sample_app-solaris/spec/requests/static_pages_tests_spec.rb:1:in `<top (required)>'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
        from /home/t103339/Sandbox/usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'

一直在看Wine软件来建立一个libkernal32.so但到目前为止还没有运气。

这不是生死攸关的。在Windows上做起来会更容易,但是我已经退休并且在Solaris上这样做对我来说是一个挑战。任何帮助都是相关的,但不要花时间远离真正需要它的人。感谢。

好的:感谢Martin Carpenter,我查看了rb-fchange.rb并注释掉了 # require "rb-fchange/native" # require "rb-fchange/native/flags" 看看会发生什么。有效!!初步的rspec工作,甚至显示失败的红色和成功的绿色。 可能会遇到问题,以评论这两个要求,但这都是实验和学习练习所以我会尝试处理问题。 谢谢马丁!

1 个答案:

答案 0 :(得分:1)

问题出在gem rb-fchange中。这是“用于监视指定目录或子树的Windows内核函数的Ruby包装器”。当然Solaris上不存在Windows内核函数,因此这解释了为什么尝试加载kernel32.dll不起作用(即使文件扩展名已自动转换为.so)。

这可能是调低堆栈的问题 - 也许有一些东西(rspec?sass?)不应该包括rb-fchange(“如果linux然后inotify else fchange”)? (也许你可以编辑你的原始问题并将痕迹粘贴在那里?...但是我们在这里的杂草有点不合适,但对于快速分辨率看起来并不那么好。)

PS。我在Solaris 10上有一些RoR的经验。与Ubuntu相比,它肯定不容易,有些事情是完全不可能的(例如SPARC上没有libv8支持)。如果可以,我会避免这种经历。