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

Fix for running the export templates with newer emscripten versions. #32448

Merged
merged 1 commit into from
Oct 1, 2019

Conversation

Relintai
Copy link
Contributor

@Relintai Relintai commented Sep 30, 2019

The issue is pretty much that argv[0] gets set to ./this.program, with the newer emscripten versions, and parameters are only added after this into the argv array.
(@fidli was talking about this in #32117.)

This is a really simple, no-refactor fix. I'm not familiar enough with emscripten yet to be able to make a more roboust solution, but at the very least it shows where the actual problem is.

By the way I found emscripten-core/emscripten#2431.
This is exactly the same thing, maybe they reintroduced this?

I've tested this with both the 1.38.27, and master emsdk.

fixes #32117
fixes #32422

@akien-mga
Copy link
Member

It would be good to figure out why this changed in Emscripten, and whether this was a conscious compatibility breakage or if it's an upstream bug.

@Relintai
Copy link
Contributor Author

Relintai commented Oct 1, 2019

I got lucky, this causes the issue:

emscripten-core/emscripten@ea85994

if I use new emscripten versions, in the wrapper js file the generated program name setup code looks like this: var thisProgram="./this.program"
On older versions it looks like this: Module["thisProgram"]="./this.program"

By the way changing var thisProgram="./this.program" to the proper expected string, makes everything work again.

I'll update the pr when I figure out how this should be used.

Close, but the real reason is that the runtime environment loses the ["thisProgram"] key. Not yet sure why.

Edit:

I think it's probably something to do with promises not fullfilling quick enough, because if I console.log the Module variable in the generated .js's RuntimeEnvironment, the thisProgram member is there, but if I try to access it it just says undefined.

But I think it will be cleaner to just separate the appname <-> .pck name guessing code, and just use 2 constants in the main html file. I'll build this, and force push it when done. (If it's good enough.)

@Relintai Relintai force-pushed the fix_run_with_new_emscripten branch from 8ec3166 to e0c994a Compare October 1, 2019 12:56
@Relintai Relintai requested a review from akien-mga as a code owner October 1, 2019 12:56
@Relintai Relintai force-pushed the fix_run_with_new_emscripten branch from e0c994a to 6f1d6cf Compare October 1, 2019 13:41
@akien-mga akien-mga merged commit bf1c81a into godotengine:master Oct 1, 2019
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants