cannot instantiate `Wasmer::Instance`
notmaxx opened this issue · 16 comments
Describe the bug
Example applications do not work
Steps to reproduce
install rust, install wasmer gem, clone repo and run example applications
Expected behavior
Examples should work
Actual behavior
$ ruby simple.rb
simple.rb:7:in `<main>': uninitialized constant Wasmer::Instance (NameError)
Did you mean? Instance
$ ruby memory.rb
memory.rb:7:in `<main>': uninitialized constant Wasmer::Instance (NameError)
Did you mean? Instance
$ ruby greet.rb
greet.rb:9:in `<main>': uninitialized constant Wasmer::Instance (NameError)
Rutie
is able to open library
Rutie.new(:wasmer).init('Init_wasmer', "$HOME/wasmerio/ruby-ext-wasm/target/")
=> #<Fiddle::Pointer:0x00007f927603caa0 ptr=0x00007ffeea97d4f0 size=0 free=0x0000000000000000>
Additional context
$ rustc --version
rustc 1.36.0 (a53f9df32 2019-07-03)
$ wasmer --version
wasmer 0.6.0
$ ruby --version
ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-darwin18]
OS: MacOS 10.14.6
I have the same issue with a strange "workaround". In IRB:
2.3.3 :001 > require "wasmer"
=> true
2.3.3 :002 > Wasmer::Instance
NameError: uninitialized constant Wasmer::Instance
Did you mean? Instance
...
2.3.3 :003 > Instance
=> Instance
Might be an issue with Rutie with Ruby 2.3.3.
The same issue with MRI 2.6.1
2.6.1 :004 > require "wasmer"
=> true
2.6.1 :005 > Wasmer::Instance
Traceback (most recent call last):
16: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
15: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/exe/bundle:30:in `block in <top (required)>'
14: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/cli.rb:18:in `start'
13: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
12: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/cli.rb:27:in `dispatch'
11: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
10: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
9: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
8: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/cli.rb:465:in `exec'
7: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:28:in `run'
6: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
5: from /Users/tikh/.rvm/gems/ruby-2.6.1/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `load'
4: from /Users/tikh/.rvm/rubies/ruby-2.6.1/bin/irb:23:in `<top (required)>'
3: from /Users/tikh/.rvm/rubies/ruby-2.6.1/bin/irb:23:in `load'
2: from /Users/tikh/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
1: from (irb):5
NameError (uninitialized constant Wasmer::Instance)
2.6.1 :006 > Instance
=> Instance
Same thing here:
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
rustc 1.35.0 (3c235d560 2019-05-20)
I did install the gem with the --verbose option and the only thing I noticed was the following fatal error messages below that most likely comes from a git command being executed from the gem file. It doesn't stop the installation though.
Building native extensions. This could take a while...
current directory: /home/ljulliard/.rvm/gems/ruby-2.6.3/gems/wasmer-0.2.0
["/home/ljulliard/.rvm/rubies/ruby-2.6.3/bin/ruby", "-rrubygems", "/home/ljulliard/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/exe/rake", "RUBYARCHDIR=/home/ljulliard/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/wasmer-0.2.0", "RUBYLIBDIR=/home/ljulliard/.rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/wasmer-0.2.0"]
**fatal: not a git repository (or any of the parent directories): .git**
bundle install
**fatal: not a git repository (or any of the parent directories): .git**
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 10.5.0
....
Does this ring a bell for anyone ?
Did you try with Ruby 2.6? This is the version I use and the version that is tested on the CI.
$ ruby examples/simple.rb
3
$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
I'm surprised @ljulliar experiences a similar issue with the same version than I have :-/.
I use Rutie 0.6.1 on Rust, and 0.0.3 on Ruby.
I do confirm I see the exact same problem on 2.6.3. I am too using rutie 0.6.1 on rust side BUT rust 0.0.4 on Ruby side and not 0.0.3 as you. Have you tried with 0.0.4 ?
I didn't. Can you try with Rutie 0.0.3 on Ruby side please?
Well actually while running
gem install --verbose wasmer
I noticed that the rutie crane installed is actually version 0.5.4, not 0.6.1 and I'm not quite sure how to force the installation of 0.6.1
cargo build --release
Compiling proc-macro2 v0.4.27
Compiling unicode-xid v0.1.0
Compiling ryu v0.2.7
Compiling syn v0.15.31
Compiling serde v1.0.90
Compiling libc v0.2.51
Compiling cc v1.0.35
Compiling autocfg v0.1.2
Compiling failure_derive v0.1.5
Compiling semver-parser v0.7.0
Compiling itoa v0.4.3
Compiling rand_core v0.4.0
Compiling byteorder v1.3.1
Compiling arrayvec v0.4.10
....
Compiling rutie v0.5.4
....
Weird. Try running cargo update
.
I think I've to update the gems, yes.
I just forgot to publish the gems… Sorry for that, it may be the issue!
Done, https://rubygems.org/gems/wasmer. Does it help?
Glad to hear that! I'm closing the issue. If someone else still experiences an installation issue, please ping me, I'll reopen.
Thanks everyone, and sorry for the rubygem oversight!