Skip to content

Instantly share code, notes, and snippets.

@rietta
Created October 20, 2012 20:25
Show Gist options
  • Save rietta/3924671 to your computer and use it in GitHub Desktop.
Save rietta/3924671 to your computer and use it in GitHub Desktop.
Rails fails in JRuby out of box on Mac OS X (with Stack Trace)
My first attempts at running a new Rails application on JRuby is completely failing. Through the process of elimination, I have traced the source of the problem down to the asset pipeline in Rails 3.2. Though I do not know how to fix this:
stat.st_gid unsupported or native support failed to load
org/jruby/RubyFileStat.java:432:in `gid'
This is on October 20, 2012. Using jruby 1.6.7 and Rails 3.2.8 out of the box with the gems as published on this date.
Here are the steps to reproduce - again, no custom code on my part.
Using Mac OS X Mountain Lion, I installed the following:
JDK 1.7 from http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html
Specify that 1.9 is preferred with the environment variable:
export JRUBY_OPTS=--1.9
JRuby 1.6.7 using rvm with the command:
rvm install jruby
Switch to using jruby with:
rvm use jruby
Install the Rails gem:
gem install rails
Create a new, completely virgin Rails project:
rails new throw_away_sample
Move into the directory and run the bundle and migrate the initial database:
cd throw_away_sample
bundle
rake db:migrate
Now running "rake assets:precompile --trace" results in
rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
stat.st_gid unsupported or native support failed to load
org/jruby/RubyFileStat.java:432:in `gid'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/activesupport-3.2.8/lib/active_support/core_ext/file/atomic.rb:39:in `atomic_write'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/activesupport-3.2.8/lib/active_support/cache/file_store.rb:91:in `write_entry'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:140:in `write_entry'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/activesupport-3.2.8/lib/active_support/cache.rb:364:in `write'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/activesupport-3.2.8/lib/active_support/cache.rb:520:in `instrument'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/activesupport-3.2.8/lib/active_support/cache.rb:362:in `write'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/caching.rb:90:in `cache_set'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/caching.rb:53:in `cache_set_hash'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/caching.rb:24:in `cache_asset'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/static_compiler.rb:23:in `compile'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/base.rb:212:in `each_logical_path'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/base.rb:200:in `each_file'
org/jruby/RubyArray.java:1615:in `each'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each_entry'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/base.rb:198:in `each_file'
org/jruby/RubyArray.java:1615:in `each'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each_file'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/sprockets-2.1.3/lib/sprockets/base.rb:210:in `each_logical_path'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/assets.rake:56:in `internal_precompile'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/assets.rake:70:in `(root)'
org/jruby/RubyProc.java:258:in `call'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
org/jruby/RubyArray.java:1615:in `each'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/Users/frank/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/monitor.rb:201:in `mon_synchronize'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/assets.rake:60:in `(root)'
org/jruby/RubyProc.java:258:in `call'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
org/jruby/RubyArray.java:1615:in `each'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/Users/frank/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/monitor.rb:201:in `mon_synchronize'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
org/jruby/RubyArray.java:1615:in `each'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/bin/rake:33:in `(root)'
org/jruby/RubyKernel.java:1068:in `load'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/bin/rake:19:in `(root)'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/frank/.rvm/rubies/jruby-1.6.7.2/bin...]
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `create_shell_runner'
org/jruby/RubyProc.java:258:in `call'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:43:in `sh'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:43:in `ruby'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/Users/frank/.rvm/gems/jruby-1.6.7.2/gems/actionpack-3.2.8/lib/sprockets/assets.rake:29:in `(root)'
org/jruby/RubyProc.java:258:in `call'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
org/jruby/RubyArray.java:1615:in `each'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/Users/frank/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/monitor.rb:201:in `mon_synchronize'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
org/jruby/RubyArray.java:1615:in `each'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/bin/rake:33:in `(root)'
org/jruby/RubyKernel.java:1068:in `load'
/Users/frank/.rvm/gems/jruby-1.6.7.2@global/gems/rake-0.9.2.2/bin/rake:19:in `'
org/jruby/RubyKernel.java:1088:in `eval'
/Users/frank/.rvm/gems/jruby-1.6.7.2/bin/ruby_noexec_wrapper:14:in `(root)'
Tasks: TOP => assets:precompile
@rietta
Copy link
Author

rietta commented Oct 22, 2012

Discussion was at
jruby/jruby#352

@rietta
Copy link
Author

rietta commented Oct 22, 2012

Fixed by deleting the following line from my .bashrc file:
export DYLD_FALLBACK_LIBRARY_PATH=/usr/X11/lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment