2014-04-02 68 views
5

我無法運行Spring。這是錯誤日誌。春天不起作用。 [未初始化的常量Spring :: SID :: DL]

myid-no-MacBook-Pro:myid$ spring 
/Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/sid.rb:17:in `fiddle_func': uninitialized constant Spring::SID::DL (NameError) 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/sid.rb:30:in `sid' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/sid.rb:39:in `pgid' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/server.rb:76:in `set_pgid' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/server.rb:33:in `boot' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/server.rb:19:in `boot' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/run.rb:33:in `block in boot_server' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/run.rb:31:in `fork' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/run.rb:31:in `boot_server' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/run.rb:16:in `call' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/command.rb:7:in `call' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client.rb:23:in `run' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/bin/spring:6:in `<top (required)>' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/spring:19:in `load' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/spring:19:in `<main>' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/ruby_executable_hooks:15:in `eval' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>' 
^C/Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/run.rb:35:in `sleep': Interrupt 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/run.rb:35:in `boot_server' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/run.rb:16:in `call' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client/command.rb:7:in `call' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/lib/spring/client.rb:23:in `run' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/spring-0.0.10/bin/spring:6:in `<top (required)>' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/spring:19:in `load' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/spring:19:in `<main>' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/ruby_executable_hooks:15:in `eval' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>' 

我用:

  • 的Ruby 1.9.3-P484
  • Rails3.2.17
  • 春0.0.10
  • OSX 10.9
  • rbenv

我試過一些其他的測試。我認爲這個問題具體是1.9.3。

myid-no-MacBook-Pro:~ myid$ ruby -v 
ruby 1.9.2p326 (2013-12-23 revision 44353) [x86_64-darwin13.1.0] 
myid-no-MacBook-Pro:~ myid$ irb 
irb(main):001:0> require 'fiddle' 
=> true 
irb(main):002:0> DL 
=> DL 
irb(main):003:0> require 'dl' 
=> false 
irb(main):004:0> DL 
=> DL 
irb(main):005:0> DL.fiddle? 
=> true 
irb(main):006:0> exit 




myid-no-MacBook-Pro:~ myid$ rbenv global 1.9.3-p484 
myid-no-MacBook-Pro:~ myid$ irb 
irb(main):001:0> require 'fiddle' 
LoadError: cannot load such file -- dl 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/fiddle.rb:4:in `<top (required)>' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from (irb):1 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/irb:12:in `<main>' 
irb(main):002:0> DL 
NameError: uninitialized constant DL 
    from (irb):2 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/irb:12:in `<main>' 
irb(main):003:0> require 'dl' 
LoadError: cannot load such file -- dl 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /Users/myid/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from (irb):3 
    from /Users/myid/.rbenv/versions/1.9.3-p484/bin/irb:12:in `<main>' 
irb(main):004:0> exit 




myid-no-MacBook-Pro:~ myid$ rbenv global 2.1.0 
myid-no-MacBook-Pro:~ myid$ irb 
irb(main):001:0> require 'fiddle' 
=> true 
irb(main):002:0> DL 
NameError: uninitialized constant DL 
    from (irb):2 
    from /Users/myid/.rbenv/versions/2.1.0/bin/irb:11:in `<main>' 
irb(main):003:0> require 'dl' 
DL is deprecated, please use Fiddle 
=> true 
irb(main):004:0> DL 
=> DL 
irb(main):005:0> DL.fiddle? 
=> true 
irb(main):006:0> 
+0

它是得到許多其他用戶https://github.com/rails/spring/issues/274你可以請嘗試與紅寶石1.9.2 –

+0

我會嘗試你的建議,但我需要紅寶石1.9.3-p484在我的生產環境中使用。 – tkymtk

回答

5

我找到了一個解決方案。

在我的情況下,從鐺改變C編譯器蘋果gcc42後完美工作。 這是我使用的命令。

$ rbenv uninstall 1.9.3-p484 
$ which gcc-4.2 
/usr/local/bin/gcc-4.2 
$ CC=/usr/local/bin/gcc-4.2 
$ rbenv install 1.9.3-p484 
$ rbenv rehash 

相關鏈接:https://github.com/rails/spring/issues/274

2

這個問題似乎被限制在一個範圍內的Ruby 1.9.3補丁級別,在Mac上編譯,使用蘋果提供的編譯器。

  • 的Ruby 1.9.3-P125,與蘋果的LLVM,春季1.1.3,編譯工作
  • 的Ruby 1.9.3-p547(最新穩定在寫作時),LLVM,春季1.1.3 - 失敗。

我有一些最新的穩定的LLVM的Ruby(2.0,2.1.2)補丁。他們工作。

所以,在1.9.3系列的某個時刻,P125之後,春季停止使用LLVM時工作。在某種程度上,至少2.0.0-p481,後來的Ruby版本和次要版本以及微型版本再次開始與LLVM一起工作。 IOW,這看起來像一個Ruby 1.9.3迴歸問題,可能是一個Ruby 2.0.0迴歸問題。我記錄了我在Github上發現的Spring問題。

現在,如果你需要1.9.3,你需要春天在Mac上...宙斯考慮。 ;)