Spring doesn't work. [ uninitialized constant Spring::SID::DL ]
Asked Answered
C

3

5

I Can't run Spring. Here is the error log.

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>'

I use:

  • Ruby 1.9.3-p484
  • Rails3.2.17
  • Spring 0.0.10
  • OSX 10.9
  • rbenv

I tried some other tests. I think this problem is 1.9.3 specific.

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> 
Collectivism answered 2/4, 2014 at 8:34 Comment(2)
It is getting for many other user github.com/rails/spring/issues/274 can you please try with ruby 1.9.2Compound
I'll try your suggestion but I need ruby 1.9.3-p484 to work which is used in my production environment.Collectivism
C
5

I found out a solution.

In my case, after changing the c compiler from clang to apple-gcc42 worked perfectly. Here are the commands I used.

$ 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

Related link: https://github.com/rails/spring/issues/274

Collectivism answered 3/4, 2014 at 4:46 Comment(0)
M
6

If changing the C compiler does not fix your issue this patch helped me: https://github.com/pigoz/spring/commit/11804d2fd3dce75e9b236666739cdf5b40934abd

Simply locate the file on your system (find where spring is installed via bundle show spring) and manually make the change.

Maroon answered 5/8, 2014 at 5:6 Comment(0)
C
5

I found out a solution.

In my case, after changing the c compiler from clang to apple-gcc42 worked perfectly. Here are the commands I used.

$ 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

Related link: https://github.com/rails/spring/issues/274

Collectivism answered 3/4, 2014 at 4:46 Comment(0)
C
2

This problem appears to be limited to a range of Ruby 1.9.3 patch levels, compiled on a Mac, using the Apple supplied compiler.

  • Ruby 1.9.3-p125, compiled with Apple's LLVM, Spring 1.1.3, works
  • Ruby 1.9.3-p547 (latest stable at time of writing), LLVM, Spring 1.1.3 - fails.

I have a couple of later patches of Ruby (2.0, 2.1.2) at latest stable, LLVM. They work.

So, at some point in the 1.9.3 series, after p125, Spring stops working when using LLVM. At some point, at least 2.0.0-p481, later Ruby versions and minor versions, and tiny versions, start working again, with LLVM. IOW, this looks like a Ruby 1.9.3 regression issue, possibly a Ruby 2.0.0 regression issue. I've documented what I've found on Github as a Spring issue.

Right now, if you need 1.9.3 and you need Spring on a Mac... consider Zeus. ;)

Clarita answered 25/7, 2014 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.