Trying to pack ruby for icp - #653
Open
graial wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greetings!
Note: This bug report and fix is AI-assisted
I decided to try and deploy Rails to Internet Computer. So this is a frontier deployment.
Status
Opening a dialogue, not seeking merge. Depends on #666 , the target-handling
fix, which is hopefully ok to merge.
What changed since the original description
The original PR took the simple, naive approach to adapt the Emscripten toolchain.
This updated
wasm32-unknown-icptarget uses wasi-sdk.RubyWasm::IcpsubclassesRubyWasm::WASISDKand only overridesname.What this PR contains
Icp < WASISDK, overridingname.Toolchain.getpassingbuild_dirandwasi_sdk_version(same as wasip1).--host wasm32-wasifor the target inproduct.rb#system_triplet_args, matching every other wasi-sdk target. A bare--host wasm32produces a build that succeeds with mis-detected features and a subtly wrongrbconfig.minimalentry in theRakefilebuild matrix.fullis deliberately absent: the stdlib depends on an unresolved filesystem question downstream, so I am deferring the attempt at afulluntil I haveminimalon a working canister.No change to
crossruby.rb. An earlier version of this PR carried anicp-specific
whenarm there; #666 removes that requirement.What the target produces
libruby-static.aand headers only. for use in running the POC deployment lives hereA canister is a reactor with entry points named
canister_initandcanister_update <name>, not a command with_start. Producing one requires a C shim that exports those, linksic-wasi-polyfill, and defines a Candid interface. None of that belongs in ruby.wasm: entry points imply aninterface, and a generic
eval : (text) -> (text)endpoint would ship acanister that executes arbitrary Ruby from any principal at the deployer's
expense.
So the target stops at the library, and the downstream steps are documented
at ruby_wasm_builder.
Parity of outputs to existing builds
There are no compile-time differences between
wasm32-unknown-icpandwasm32-unknown-wasip1today. Building both at3.3-...-minimaland comparing the resultinglibruby-static.agives identical defined symbol sets, 18,606 symbols.The archives are not byte-identical, due to filepath differences which get baked into the debug info. The configure invocations differ only in
--host-adjacent naming; both receive the same wasi-sdk compiler, the same four_WASI_EMULATED_*defines, and the sameac_cv_func_*overrides.So this triple exists so the IC can diverge later. We have not identified any IC-specific flags yet.
Open questions for maintainers
wasm32-unknown-icpthe right name?wasm32-wasip1-icpwould signal the sysroot relationship more clearly.Context
https://forum.dfinity.org/t/wasi-snapshot-preview1-equivalent/72239
乾杯!!