Misc #19120
Updated by jaruga (Jun Aruga) over 1 year ago
We are trying to add the new YJIT feature that is ported to Rust[1][2] in Ruby 3.2 RPM on Fedora project.[3]
I am trying to understand how the YJIT works in the case the `./configure --enable-yjit --enable-shared`. In the case below, when building Ruby on the latest master branch `199b59f065ce6f1c13b8424f35a70c513523211b`, the static libraries `libruby-static.a` and `./libruby-static.a` were built.
```
<mock-chroot> sh-5.2$ cat /etc/fedora-release
Fedora release 38 (Rawhide)
<mock-chroot> sh-5.2$ ./autogen.sh
<mock-chroot> sh-5.2$ ./configure --prefix=$HOME/local/ruby-yjit-199b59f065 --enable-shared --enable-yjit 2>&1 | tee configure.log
...
* MJIT support: yes
* YJIT support: yes
<mock-chroot> sh-5.2$ make
<mock-chroot> sh-5.2$ find . -name "*.a"
./yjit/target/release/libyjit.a
./libruby-static.a
```
After running `make install`, these static libraries (`*.a` files) were not copied to the installed directory. That makes sense, as Ruby works with shared libraries (`*.so` files).
```
<mock-chroot> sh-5.2$ make install 2>&1 | tee make_install.log
<mock-chroot> sh-5.2$ find ~/local/ruby-yjit-199b59f065/ -name "*.a"
=> empty
```
In this case, we really don't need the `libyjit.a` to run the YJIT right? I couldn't find the .so file something like `yjit.so`. Which .so file contains the YJIT feature (maybe the content of the `yjit/src/**/*.rs`)?
```
<mock-chroot> sh-5.2$ find ~/local/ruby-yjit-199b59f065/ -name "*.so" | grep yjit.so
=> empty
```
How can we test the content of the `yjit/src/**/*.rs`? For example, if the command below works, I can say that I tested the content of the `yjit/src/**/*.rs`?
```
<mock-chroot> sh-5.2$ which rustc
/usr/bin/rustc
<mock-chroot> sh-5.2$ rustc --version
rustc 1.65.0 (Fedora 1.65.0-1.fc38)
<mock-chroot> sh-5.2$ ~/local/ruby-yjit-199b59f065/bin/ruby --yjit -e 'puts "abc"'
abc
```
## References
* [1] https://bugs.ruby-lang.org/issues/18481
* [2] https://github.com/ruby/ruby/commit/f90549cd38518231a6a74432fe1168c943a7cc18#diff-1d53751ddf3ffeb25cfe609c6bd28746651e23ea81d51fe582b0f635f0896e0d
* [3] https://src.fedoraproject.org/rpms/ruby/pull-request/139