on-the-fly installa2on demo at RubyKaigi 2022. • Network access is passed through the browser's fetch API. • You can try it now on runruby.dev by Svyatoslav • No built-in support 13
the core of the C-extension build system in Ruby • 3 major mkmf users (extconf.rb consumers in in other words): • CRuby build system • rake-compiler • RubyGems 26
order to avoid error # "cannot load such file -- win32/resolv" when it is required later on. # See also: https://github.com/tjschuck/rake-compiler-dev-box/issues/5 require 'resolv' require 'rbconfig' ... 29
Add --target-rbconfig op3on to mkmf2 h9ps:/ /bugs.ruby-lang.org/issues/20345 $ ruby extconf.rb --target-rbconfig=path/to/rbconfig.rb creating Makefile $ make $ file nokogiri.so nokogiri.so: WebAssembly (wasm) binary module version 0x1 (MVP) 2 Will be available in Ruby 3.4 and later 30
We already support sta/cally-linked C-extensions • But, the build model is not suitable for the RubyGems ecosystem • Take a long linking /me (especially due to Asyncify) • Need to /ghtly integrate with the CRuby build system 33
far? • WebAssembly does not have a standard dynamic linking ABI • If we do our bespoke dynamic linking3, the binary will be incompa?ble with standard WebAssembly run?mes 3 Emscripten does dynamic linking by its own loader 35
concept of dynamic linking in WebAssembly • Done at the build /me • The final binary is a Component • The linker is originally developed by Joel Dice in wit-component • Adjusted for Ruby use case 39
linking • The final binary, a Component, contains all the dependencies • No file-based shared library search at run:me • dlopen is available only for libraries known at build-:me 40