Hi,

I don't have much experience with WASM compilation on Fedora.

There are some examples online running Ruby compiled to WASM.

The most prominent example is TryRuby [0], see source [1].
It seems like they are pulling an NPM package [2] of already compiled Ruby wasm.
I see some usage of Emscripten and WASI SDK [3] but don't take me seriously on that.

Or you can go completely from source. Then you want to follow Ruby's upstream README on wasm crosscompilation [4].

I think clang can cross-compile to WASM, not sure if GCC also has this capability.
Either way you will need wasi-libc for this, which is not currently included in Fedora [5] and [6].
The wasi-libc is currently the major pain point for simple cross-compilation and that applies not just to Ruby,
but other similar cross-compilation efforts as well.

Alternatively, if you're more interested in having a Ruby project run in browser than all the toolchain setup,
there is a project called "Opal" [7] [8], which seems simpler to me at least from the setup side of things.

The pathway is ultimately yours, from my Point of View these are uncharted territories in both Fedora Ruby's and Fedora packaging.
If you happen to compile it yourself from sources, I'd love to hear back from you about the progress and/or steps.

Regards,
Jarek

[0] https://try.ruby-lang.org/playground/#code=3.times+do%0A++print+'Welcome+'%0Aend&engine=cruby-3.2.0dev
[1] https://github.com/ruby/TryRuby
[2] https://www.npmjs.com/package/ruby-head-wasm-wasi
[3] https://github.com/ruby/ruby.wasm/blob/main/lib/ruby_wasm/build_system/toolchain.rb#L55
[4] https://github.com/ruby/ruby/tree/master/wasm#webassembly--wasi-port-of-ruby
[5] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DV73PPNOCQUQF5JZWNSSPLSXORW6ZIOX/#S7G5BGGFAJSPUJD2TTGQFMLJA4Y2JMQM
[6] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/JO2YYDQPC65EMQVO6UCHDV4SAKQNSGKV/#ILIL542CBEN6HMVQPK4JDKL4RHZWF2BI
[7] https://opalrb.com/
[8] https://github.com/opal/opal

On 1/9/23 12:10, Jun Aruga (he / him) wrote:
Hi Philip,
I added a Ruby SiG mailing list to TO.

Folks at Ruby SiG,
Could you take a look at the message below? Philip is trying to create
a RPM package including WASM built Ruby binaries. Your feedback is
helpful.

On Mon, Jan 9, 2023 at 11:00 AM Philip Rhoades <phil@pricom.com.au> wrote:
Jun,


On 2023-01-09 00:36, Jun Aruga (he / him) wrote:
On Sun, Jan 8, 2023 at 11:51 AM Philip Rhoades via devel
<devel@lists.fedoraproject.org> wrote:
People,

Over the holidays we had our irregular Family Lightning Chess
competition (10 seconds per move) - I have not found an online web
site
that will work exactly with our rules and it occurs to me that this
would be a nice project for me to get working via a Ruby2WASM project.
If I could get that project working, it would allow the family to have
at least annual electronic competitions for the times when not all the
relatives can physically make it to the one place at the one time . .

What do you think?
Good idea!

Good! - I wasn't sure if it was or note . .


Ruby 3.2 released a few weeks ago, started to support the WASM built
feature, and I guess that people want to use it easily.

I certainly do!


The first choice for the packaging is to create WASM built binaries as
a sub package of "ruby" https://src.fedoraproject.org/rpms/ruby or to
create a new package with the new RPM spec file.

I don't know about that but it would be good for me to get started with
a "Hello World!" Ruby2WASM app and go from there . .
OK. I think trying to create a minimal RPM package such as "Hello
World" is a good idea if you have never experienced RPM packaging.
Then as your next step, you may be able to try to build by creating
your package by copying the current rpms/ruby's ruby.spec to e.g.
ruby-wasm.spec, and modifying it to build WASM binaries.

Tutorial: https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/
Packaging Guide: https://docs.fedoraproject.org/en-US/packaging-guidelines/

We discussed if we shipped WASM binaries a bit in the ruby-sig@
mailing list. I can recommend you to join the list to discuss people
in the ruby related packages  if you like.

* Ruby 3.2 - ruby-sig@

https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org/thread/FK3XRKUICBS7HFZVEENSEGJ4ZMKCVNWF/

Yes, I read that stuff and am subscribed to that list now.
OK. Nice!

Fedora WASM SIP might be launched. You can check the situation.

* Web Assembly on Fedora: interested in a Fedora SIG to work on this?

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/JO2YYDQPC65EMQVO6UCHDV4SAKQNSGKV/

Happy to join that list too but that is a much wider deal than the
Ruby2WASM project?
Yes. right. I think it's about WASM things more than Ruby.
For example, it's about what you need to do to build WASM binaries of
Ruby, and which dependency RPM packages you need.

Thanks!

Phil.
--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  phil@pricom.com.au
Thanks too!