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

Emscripten travis failure #853

Closed
binji opened this issue Jun 4, 2018 · 2 comments
Closed

Emscripten travis failure #853

binji opened this issue Jun 4, 2018 · 2 comments

Comments

@binji
Copy link
Member

binji commented Jun 4, 2018

Not quite sure what's failing here, though maybe I'm doing something weird w/ --pre-js:

See this travis failure for example.

Assertion failed: could not find the assigment to "asmLibraryArg". perhaps 
--pre-js or --post-js code moved it out of the global scope? (things like that 
should be done after emcc runs, as they do not need to be run through the 
optimizer which is the special thing about --pre-js/--post-js code)

@kripken, any clues?

@kripken
Copy link
Member

kripken commented Jun 4, 2018

Reading that error message it does sound familiar. I believe the issue is that your pre and post js files put the output in a function scope. pre/post js files are added before optimization, and changing scope confuses the optimizer, which doesn't recognize the patterns it is looking for (and when optimizing it may do invalid things given the scope change compared to what it expects).

Adding a function scope like that doesn't need to be seen by the optimizer, so one solution is to prepend&append that code not using --pre/post js, but just manually, after emcc runs.

Another option is to use the MODULARIZE or MODULARIZE_INSTANCE options to put the output in a scope. That should also do the exporting I see you have at the end of the post.js.

@binji
Copy link
Member Author

binji commented Jun 4, 2018

Ah, thanks, I see. The error message makes more sense now. I'll give that a shot!

binji added a commit that referenced this issue Jun 4, 2018
It's not correct to use `--pre-js` and `--post-js` to wrap the module in
a function instance; instead we're supposed to use `-s MODULARIZE=1`.

This still keeps the build as (almost) asm.js, as switching to wasm is a
bit more work (we need to preload the wasm binary module).

This fixes issue #853.
@binji binji closed this as completed Sep 13, 2018
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