3 ms·
How would I go about creating a native image for a gem I've installed? I can't seem to find the documentation for this. Or have I misunderstood this totally? I
by rraghur 8y ago
How would I go about creating a native image for a gem I've installed? I can't seem to find the documentation for this.
Or have I misunderstood this totally? I thought I could do something like ruby script -> graal ruby --> jvm bytecode --> native image
Update:: Doesn't look like I read it wrong - from this reddit comment[1] from 3months ago
Ahh, I think there's some confusion here. What we do with the SVM is ahead of time compile the TruffleRuby interpreter, not an application. This is akin to what you'd do with MRI. Instead of treating Java as a language you compile to a .class file and load with the JVM, the SVM's native image generator compiles it to a native binary.
There's likely no reason we couldn't compile Ruby applications into a static binary.
I would also love to be able to distribute a ruby binary as a single statically compiled executable. Any pointers/directions?
[1] https://www.reddit.com/r/ruby/comments/7o3wy9/graals_substrate_vm_is_now_open_source_what_does/ds9hnjv/ https://www.reddit.com/r/ruby/comments/7o3wy9/graals_substra...
- chrisseaton 8y ago> There's likely no reason we couldn't compile Ruby applications into a static binary. I think this was a theoretical observation. What is more likely in the near future is to be able to initialise your Ruby gem at compile time, so when you start your application it is already required and you can start execution as if all your require statements had already run.