API Only Mode:
I build a docker image docker run -it lusu777/truffle-ruby:1.0.0-rc1
https://github.com/andreimc/docker-images/tree/master
rails new api-play --api
Ok so first go msgpack seems to error out -- this is because of bootsnap - let's try removing it
bundle exec rails s
/usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/truffle/truffle/cext.rb:221:in `execute_without_conversion': Error in C extension code (SulongRuntimeException): (RuntimeError)
Cannot convert LLVMTruffleObject(LLVMTypedForeignObject:0) to LLVMAddress (IllegalStateException)
from msgpack_packer_ext_registry_init in packer_ext_registry.c:33:11 (LLVM IR Function msgpack_packer_ext_registry_init in /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/msgpack-1.2.4/lib/msgpack/msgpack.su@918828e71a73a3c14d873e477de87f2351d19bbc_out.bc in Block {id: 0 name: %0})
from Factory_initialize in factory_class.c:72:5 (LLVM IR Function Factory_initialize in /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/msgpack-1.2.4/lib/msgpack/msgpack.su@918828e71a73a3c14d873e477de87f2351d19bbc_out.bc in Block {id: 2name: %12})
from java.lang.Throwable.<init>(Throwable.java:287)
Caused by:
Message not supported: TO_NATIVE (UnsupportedMessageException)
from java.lang.Throwable.<init>(Throwable.java:265)
from java.lang.Exception.<init>(Exception.java:66)
from com.oracle.truffle.api.interop.InteropException.<init>(InteropException.java:36)
from com.oracle.truffle.api.interop.UnsupportedMessageException.<init>(UnsupportedMessageException.java:41)
from com.oracle.truffle.api.interop.UnsupportedMessageException.raise(UnsupportedMessageException.java:68)
from org.truffleruby.interop.RubyMessageResolution$ForeignToNativeNode.access(RubyMessageResolution.java:192)
from org.truffleruby.interop.RubyMessageResolutionForeign$ForeignToNativeSubNode.accessWithTarget(RubyMessageResolutionForeign.java:503)
from org.truffleruby.interop.RubyMessageResolutionForeignFactory$ForeignToNativeSubNodeGen.executeAndSpecialize(RubyMessageResolutionForeignFactory.java:602)
from org.truffleruby.interop.RubyMessageResolutionForeignFactory$ForeignToNativeSubNodeGen.executeWithTarget(RubyMessageResolutionForeignFactory.java:588)
from org.truffleruby.interop.RubyMessageResolutionForeign$ForeignToNativeSubNode$TO_NATIVERootNode.execute(RubyMessageResolutionForeign.java:520)
Translated to internal error
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/truffle/truffle/cext.rb:221:in `execute_with_mutex'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/truffle/truffle/cext_ruby.rb:27:in `initialize'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/msgpack-1.2.4/lib/msgpack.rb:22:in `new'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/msgpack-1.2.4/lib/msgpack.rb:22:in `MessagePack'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/msgpack-1.2.4/lib/msgpack.rb:21:in `<top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/store.rb:3:in `require'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/store.rb:3:in `block in <top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/explicit_require.rb:40:in `with_gems'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/store.rb:3:in `<top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache.rb:55:in `require_relative'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache.rb:55:in `<top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap.rb:3:in `require_relative'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap.rb:3:in `<top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/setup.rb:1:in `require_relative'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/bootsnap-1.3.0/lib/bootsnap/setup.rb:1:in `<top (required)>'
from /my-rails-api/config/boot.rb:4:in `require'
from /my-rails-api/config/boot.rb:4:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
vi Gemfile comment out gem 'bootsnap'
vi config/boot.rb comment out require bootsnap/setuo
ok so next it's another issue: seems like concurrent.
according to this it should work ... hmm next steps, monkey patch execution wrapper?
bash-4.2# export RUBY_ENGINE=truffleruby
bash-4.2# bundle exec rails s
Possibly unsupported Ruby implementation
/usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:102:in `const_missing': uninitialized constant Concurrent::Hash (NameError)
Did you mean? Hash
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:102:in `ExecutionWrapper'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:6:in `ActiveSupport'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:5:in `<top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/executor.rb:3:in `require'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/executor.rb:3:in `<top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/application.rb:138:in `initialize'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/railtie.rb:167:in `new'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/railtie.rb:167:in `instance'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/application.rb:99:in `instance'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/railtie.rb:127:in `config'
from /my-rails-api/config/application.rb:23:in `Application'
from /my-rails-api/config/application.rb:21:in `MyRailsApi'
from /my-rails-api/config/application.rb:20:in `<top (required)>'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:145:in `require'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:145:in `block in perform'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `__send__'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke'
from /usr/graalvm-1.0.0-rc1/jre/languages/ruby/lib/ruby/gems/2.3.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Hi thanks for the report. We'll look into this.
This is a problem in ConcurrentRuby, it will be fixed in next patch release.
There is a ConcurrentRuby 1.1.0.pre1 version which fixes the issue.
rails new api-play --api seems to work fine using 1.0.0-rc7, at least on Ubuntu 18.04.1. There was a warning about a deprecated gem that this uses. The sassc gem also seems to install fine.
Bundle complete! 11 Gemfile dependencies, 59 gems now installed.
Use bundle info [gemname] to see where a bundled gem is installed.
Post-install message from sass:
Ruby Sass is deprecated and will be unmaintained as of 26 March 2019.
If you use Sass as a command-line tool, we recommend using Dart Sass, the new
primary implementation: https://sass-lang.com/install
If you use Sass as a plug-in for a Ruby web framework, we recommend using the
sassc gem: https://github.com/sass/sassc-ruby#readme
For more details, please refer to the Sass blog:
http://sass.logdown.com/posts/7081811
New ConcurrentRuby 1.1 was released which fixes the issue.
Most helpful comment
There is a ConcurrentRuby 1.1.0.pre1 version which fixes the issue.