ruby.wasm icon indicating copy to clipboard operation
ruby.wasm copied to clipboard

Gems with native extensions

Open danini-the-panini opened this issue 1 year ago • 7 comments

Can we use gems with native extensions? I've read somewhere that it is possible, and it makes sense for it to be possible. However, I'm struggling to get even a basic example to compile. There doesn't seem to be any documentation as to how to set it up.

If I try statically linking, I get the error "Could not create Makefile due to some reason". Checking the mkmf log does not yield any useful information.

If I try dynamically linking with RUBY_WASM_EXPERIMENTAL_DYNAMIC_LINKING, I get the error ld: unknown option: -Xlinker

I've created a minimal repo to test: https://github.com/danini-the-panini/rbwasm-foo

If it makes a difference, I'm running on Apple silicon.

danini-the-panini avatar May 06 '24 22:05 danini-the-panini

Ok I tried on linux x86_64 and I get the same errors, although the dynamic linking says ld: Error: unable to disambiguate: -Xlinker (did you mean --Xlinker ?)

danini-the-panini avatar May 06 '24 23:05 danini-the-panini

It's still experimental, and I need to do some upstreaming works. Stay tuned 😉

kateinoigakukun avatar May 07 '24 04:05 kateinoigakukun

ok, is there any way I can help?

danini-the-panini avatar May 07 '24 07:05 danini-the-panini

Blockers

  • [ ] https://github.com/ruby/ruby.wasm/pull/442
  • [ ] https://github.com/rubygems/rubygems/pull/7628

kateinoigakukun avatar May 17 '24 07:05 kateinoigakukun

Being able to use native extensions would be pretty great. I picture being able to use libui-ng (the ruby bindings of it) as well as glimmer, for some kind of unified GUI that also extends into the world wide web (aka one code base, to use GUIs even for web-applications, writing the underlying code only once, and then having it work on ALL the platforms, including web-related use cases). This may also be great if jruby works on that, then we can also have e. g. swing-GUIs, so ... GUIs galore.

rubyFeedback avatar Jun 09 '24 01:06 rubyFeedback

Being able to use native extensions would be pretty great. I picture being able to use libui-ng (the ruby bindings of it)

I think LibUI hooks into windows/linux/OSX code, so that doesn't seem possible? If you want to make GUIs, you can see my examples and use html and css. If you want to talk more about this, we can do it on the discussion tab.

Largo avatar Jun 09 '24 05:06 Largo