Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Using custom build of starlingmonkey #110

Open
karthik2804 opened this issue May 28, 2024 · 7 comments
Open

Question: Using custom build of starlingmonkey #110

karthik2804 opened this issue May 28, 2024 · 7 comments

Comments

@karthik2804
Copy link
Contributor

karthik2804 commented May 28, 2024

I am attempting to use the engine produced by a debug build of the PR that refactors fetch.

My understanding is that it should be sufficient to pass the engine argument to the componentize function as below:

const { component, imports } = await componentize(source, {
    sourceName: basename(src),
    witPath: resolve(args.witPath),
    worldName: args.triggerType,
    engine: "./starlingmonkey/cmake-build-debug/starling.wasm",
    disable features: [],
});

I run into the following error.

thread '<unnamed>' panicked at crates/spidermonkey-embedding-splicer/src/splice.rs:119:80:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
wasm://wasm/01874b72:1


RuntimeError: unreachable
    at __rust_start_panic (wasm://wasm/01874b72:wasm-function[6443]:0x372beb)
    at rust_panic (wasm://wasm/01874b72:wasm-function[6431]:0x37262c)
    at _ZN3std9panicking20rust_panic_with_hook17hc97f08b908247b1dE (wasm://wasm/01874b72:wasm-function[6430]:0x37255f)
    at _ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17hdd638bdaba0c6bccE (wasm://wasm/01874b72:wasm-function[6418]:0x3718f7)
    at _ZN3std10sys_common9backtrace26__rust_end_short_backtrace17h5b392607309abb6aE (wasm://wasm/01874b72:wasm-function[6417]:0x37185d)
    at rust_begin_unwind (wasm://wasm/01874b72:wasm-function[6425]:0x371f36)
    at _ZN4core9panicking9panic_fmt17h9fec598e5939a913E (wasm://wasm/01874b72:wasm-function[6588]:0x38040f)
    at _ZN4core9panicking5panic17h711f5cad5118a4ddE (wasm://wasm/01874b72:wasm-function[6599]:0x381c2f)
    at _ZN30spidermonkey_embedding_splicer6splice27synthesize_import_functions17hd2a9a03ce4744861E (wasm://wasm/01874b72:wasm-function[106]:0x2a36b)
    at _ZN30spidermonkey_embedding_splicer6splice6splice17h5faa7a23aef7cffbE (wasm://wasm/01874b72:wasm-function[105]:0x25dbf)

Is there some trick to getting this to work? or is the current state of the PR incompatible?
Thanks!

@guybedford
Copy link
Collaborator

The engine to be built is lib/starlingmonkey_embedding.debug.wasm (the release build won't work pending bytecodealliance/StarlingMonkey#50).

To get this file, run make lib/starlingmonkey_embedding.debug.wasm.

The StarlingMonkey build is referenced as a submodule of this repo.

@guybedford
Copy link
Collaborator

guybedford commented May 28, 2024

Hmm actually the debug build of ComponentizeJS isn't working itself, so you do have to use a release build.

Therefore until bytecodealliance/StarlingMonkey#53 is landed you won't be able to progress here.

@karthik2804
Copy link
Contributor Author

The debug build was not working and the workaround I used was to modify the makefile to build a debug build instead of RelWithDebInfo

cmake -B build-debug -DCMAKE_BUILD_TYPE=RelWithDebInfo

and then modifying the JS script to point at the right reference.

new URL(`../lib/starlingmonkey_embedding.wasm`, import.meta.url)

which led me into running into the following error

Splicer error: unable to read prelude sequence, continuing for debug build but note binding functions will not work

@guybedford
Copy link
Collaborator

Yes, the debug build does not work for ComponentizeJS.

@karthik2804
Copy link
Contributor Author

Thanks! This is helpful.

@guybedford
Copy link
Collaborator

Latest release build fix for StarlingMonkey is in bytecodealliance/StarlingMonkey#53.

@guybedford
Copy link
Collaborator

I've updated the internal build in #111 as an example.

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

No branches or pull requests

2 participants