Greeting @mitnick2012 ! Thanks for the engagement and feedback!
Oof ya even the current releases of the wasmified ruby interpreter sit at 22Mb. so rails ain’t gonna fly. Even getting the ruby interpreter to run will be a challenge.
Here are the unsupported imports of ruby 3.3 (the version I was able to build with rails build): https://github.com/ruby/ruby.wasm/releases/download/2.9.4/ruby-3.3-wasm32-unknown-wasip1-minimal.tar.gz
Does this list indicate all imports? Or only the unsupported ones?
Module imports:
import “wasi_snapshot_preview1” “args_get”
import “wasi_snapshot_preview1” “args_sizes_get”
import “wasi_snapshot_preview1” “environ_get”
import “wasi_snapshot_preview1” “environ_sizes_get”
import “wasi_snapshot_preview1” “clock_res_get”
import “wasi_snapshot_preview1” “clock_time_get”
import “wasi_snapshot_preview1” “fd_advise”
import “wasi_snapshot_preview1” “fd_close”
import “wasi_snapshot_preview1” “fd_datasync”
import “wasi_snapshot_preview1” “fd_fdstat_get”
import “wasi_snapshot_preview1” “fd_fdstat_set_flags”
import “wasi_snapshot_preview1” “fd_filestat_get”
import “wasi_snapshot_preview1” “fd_filestat_set_size”
import “wasi_snapshot_preview1” “fd_pread”
import “wasi_snapshot_preview1” “fd_prestat_get”
import “wasi_snapshot_preview1” “fd_prestat_dir_name”
import “wasi_snapshot_preview1” “fd_pwrite”
import “wasi_snapshot_preview1” “fd_read”
import “wasi_snapshot_preview1” “fd_readdir”
import “wasi_snapshot_preview1” “fd_renumber”
import “wasi_snapshot_preview1” “fd_seek”
import “wasi_snapshot_preview1” “fd_sync”
import “wasi_snapshot_preview1” “fd_tell”
import “wasi_snapshot_preview1” “fd_write”
import “wasi_snapshot_preview1” “path_create_directory”
import “wasi_snapshot_preview1” “path_filestat_get”
import “wasi_snapshot_preview1” “path_filestat_set_times”
import “wasi_snapshot_preview1” “path_link”
import “wasi_snapshot_preview1” “path_open”
import “wasi_snapshot_preview1” “path_readlink”
import “wasi_snapshot_preview1” “path_remove_directory”
import “wasi_snapshot_preview1” “path_rename”
import “wasi_snapshot_preview1” “path_symlink”
import “wasi_snapshot_preview1” “path_unlink_file”
import “wasi_snapshot_preview1” “poll_oneoff”
import “wasi_snapshot_preview1” “proc_exit”
import “wasi_snapshot_preview1” “random_get”
Error: There are imports remaining that are not compatible with the Internet Computer.
Happily, no new (unsupported?) imports are introduced from ‘minimal’ to ‘full’
These are the additional imports introduced by my rails build:
Module imports:
import "rb-js-abi-host" "rb_wasm_throw_prohibit_rewind_exception"
import "canonical_abi" "resource_drop_js-abi-value"
import "rb-js-abi-host" "eval-js: func(code: string) -> variant { success(handle), failure(handle) }"
import "rb-js-abi-host" "is-js: func(value: handle) -> bool"
import "rb-js-abi-host" "instance-of: func(value: handle, klass: handle) -> bool"
import "rb-js-abi-host" "global-this: func() -> handle"
import "rb-js-abi-host" "int-to-js-number: func(value: s32) -> handle"
import "rb-js-abi-host" "float-to-js-number: func(value: float64) -> handle"
import "rb-js-abi-host" "string-to-js-string: func(value: string) -> handle"
import "rb-js-abi-host" "bool-to-js-bool: func(value: bool) -> handle"
import "rb-js-abi-host" "proc-to-js-function: func(value: u32) -> handle"
import "rb-js-abi-host" "rb-object-to-js-rb-value: func(raw-rb-abi-value: u32) -> handle"
import "rb-js-abi-host" "js-value-to-string: func(value: handle) -> string"
import "rb-js-abi-host" "js-value-to-integer: func(value: handle) -> variant { as-float(float64), bignum(string) }"
import "rb-js-abi-host" "export-js-value-to-host: func(value: handle) -> ()"
import "rb-js-abi-host" "import-js-value-from-host: func() -> handle"
import "rb-js-abi-host" "js-value-typeof: func(value: handle) -> string"
import "rb-js-abi-host" "js-value-equal: func(lhs: handle, rhs: handle) -> bool"
import "rb-js-abi-host" "js-value-strictly-equal: func(lhs: handle, rhs: handle) -> bool"
import "rb-js-abi-host" "reflect-apply: func(target: handle, this-argument: handle, arguments: list<handle>) -> variant { success(handle), failure(handle) }"
import "rb-js-abi-host" "reflect-get: func(target: handle, property-key: string) -> variant { success(handle), failure(handle) }"
import "rb-js-abi-host" "reflect-set: func(target: handle, property-key: string, value: handle) -> variant { success(handle), failure(handle) }"
import "canonical_abi" "resource_new_rb-abi-value"
import "canonical_abi" "resource_get_rb-abi-value"
When you say ‘the runtime doesn’t provide the import’ that sounds like an issue lower down the stack than the Canister Development Kits that I saw a category about in this forum, correct?
This is the reference runtime that ruby-wasm refers to
Where there is divergence in supported imports, is this because IC hasn’t caught up to the standard? or are the ‘rb_js_’ & ‘wasi_snapshot_’ imports a customization that IC would have to decide to support?
Aside from your suggestions about trimming down imports in my build, what options do I have on the ICP side for trying to customize the canister/runtime?
Cheers