Dne 09. 11. 22 v 12:34 Jun Aruga (he / him) napsal(a):
On Mon, Nov 7, 2022 at 10:44 AM Vít Ondruch
<vondruch(a)redhat.com> wrote:
>
> Dne 04. 11. 22 v 19:13 Jun Aruga (he / him) napsal(a):
>>> I have put together the change proposal:
>>>
>>>
https://fedoraproject.org/wiki/Changes/Ruby_3.2
>>>
>>> Please review, although with exception of "Detailed Description"
>>> chapter, where the changes are described, it is basically just
>>> copy/paste of the Ruby 3.1 change proposal.
>>>
>>> I have marked the change as "ChangeReadyForWrangler" already. BTW
>>> everybody feel free to add yourselves as a change (co-)owner.
>> For the "WASI based WebAssembly support" feature, there is no way to
>> use this feature from Ruby RPM. Users need to build Ruby from the
>> source with a specific build target configure option. Does it make
>> sense to show the feature on the proposal page?
>>
> Could you please elaborate? Do you suggest we should describe how to
> prepare that build or that we should rather not mention WASI, because
> the RPM does not actually support it?
Sure. First, are you ok for the part 'For the "WASI based WebAssembly
support" feature, there is no way to use this feature from Ruby RPM.'?
That means
https://bugs.ruby-lang.org/issues/19053#note-3
When building ruby to run on the WebAssembly runtime with `configure
--host wasm32-unknown-wasi`, it works on the WebAssembly runtime
(wasmtime).
```
$ pwd
/home/jaruga/src/ruby-3.2.0-preview2_wasi_fedora
$ ./autogen.sh
$ ./configure LDFLAGS="-Xlinker -zstack-size=16777216" \
-prefix=/usr/local/ruby-3.2.0-preview2-wasm32-wasi \
--host wasm32-unknown-wasi \
--with-destdir=./ruby-wasm32-wasi \
--with-static-linked-ext \
--with-ext=ripper,monitor
$ make
$ make install
$ wasmtime ruby-wasm32-wasi/usr/local/ruby-3.2.0-preview2-wasm32-wasi/bin/ruby
--mapdir /::./ruby-wasm32-wasi/ -- -e 'puts RUBY_PLATFORM'
wasm32-wasi
```
But the binary doesn't work on normal use.
```
$ ruby-wasm32-wasi/usr/local/ruby-3.2.0-preview2-wasm32-wasi/bin/ruby -v
bash: ruby-wasm32-wasi/usr/local/ruby-3.2.0-preview2-wasm32-wasi/bin/ruby:
cannot execute binary file: Exec format error
$ ruby-wasm32-wasi/usr/local/ruby-3.2.0-preview2-wasm32-wasi/bin/ruby
-e 'puts "a"'
bash: ruby-wasm32-wasi/usr/local/ruby-3.2.0-preview2-wasm32-wasi/bin/ruby:
cannot execute binary file: Exec format error
```
Because the binary format is different.
```
$ file /usr/bin/ruby-mri
/usr/bin/ruby-mri: ELF 64-bit LSB pie executable, x86-64, version 1
(SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=37b172d9897934e511f5e8496b7409471488a99e, for GNU/Linux
3.2.0, stripped
$ file ruby-wasm32-wasi/usr/local/ruby-3.2.0-preview2-wasm32-wasi/bin/ruby
ruby-wasm32-wasi/usr/local/ruby-3.2.0-preview2-wasm32-wasi/bin/ruby:
WebAssembly (wasm) binary module version 0x1 (MVP)
Thx for explanation and useful examples.
```
> I don't think that the former would be really valuable. Unless the RPM
> package Ruby would make it easier in some way.
I am suggesting that "we should rather not mention WASI, because the
RPM does not actually support it". That is what we did for our
document about the MJIT in the past in the RHEL side, as the MJIT
didn't work due to RHEL's hardening setting. Or just add note that
"the Ruby RPM doesn't support the WebAssemly. If you want to use the
feature, compile from the source."
I have dropped the section entirely. Because based on your explanation,
I'd say that WebAssembly is currently out of scope, as long as we are
not able to provide the WebAssembly Ruby blob.
Thx a lot. Appreciate your help.
Vít