Skip to content

Trying to pack ruby for icp#653

Open
graial wants to merge 2 commits into
ruby:mainfrom
graial:main
Open

Trying to pack ruby for icp#653
graial wants to merge 2 commits into
ruby:mainfrom
graial:main

Conversation

@graial

@graial graial commented Jul 21, 2026

Copy link
Copy Markdown

Greetings!

I decided recently to see if I could deploy Rails to Internet Computer.
They are only starting to get Wordpress partially deployed at the moment. So this is a frontier deployment.

So far, I know that I need to provide some polyfills for the wasi-snapshot-preview1 and am still learning the specifics of the runtime.

I also understand that a rails app on ICP will need to be split up into serverless functions.

For now, I'm just trying to get a successful build. If it's successful, I wonder if/how you would want to add this support?

What I've done

With this PR, I've generated a new build profile called wasm32-unknown-icp.

What's working

I can compile, pack and run the quick example on wasip1

I can compile for emscripten & icp targets using the command rake --verbose build:3.3-wasm32-unknown-icp-full

What's not working

I cannot convert the wasip1 build to ic using wasi2ic. I end up with lots of incompatible imports from the wasi-snapshot-preview1 (see discussion here)

I cannot pack the quick example on emscripten or icp. they fail with:

lib/ruby_wasm/cli.rb:178:in `run_cli': failed to run wasi vfs cli:
magic header not detected: bad magic number - expected=[ (StandardError) 0x0, 0x61, 0x73, 0x6d,] actual=[ 0x23, 0x21, 0x2f, 0x75,] (at offset 0x0)

I tried emscripten first because the handler seemed simpler. But I think ICP mentioned that wasip1 can be supported. So maybe I can try linking the polyfills into the wasip1 module next.

Side Note: I'm focusing on 3.3 right now because I was able to deploy it via wasmify_rails previously. I was unsuccessful in trying Versions 3.4 or 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant