godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.56k stars 20.73k forks source link

Godot WebGL export doesn't work on Safari #37931

Open drmar opened 4 years ago

drmar commented 4 years ago

Godot version: 3.2.1.stable

OS/device including version: macOS Catalina 10.15.4 / MacBookPro11,1 Safari version: 13.1 (15609.1.20.111.8) Although this problem happens on the latest version of Safari, I remember that it happened on earlier versions of Safari too.

Issue description: I quickly exported this project to WebGL and uploaded it to itch.io: https://stone-age-jazz.itch.io/godot-weggl-test PASSWORD: godot

The project is barebones, standard configuration, nothing has been changed. The game does not work when running the game from Safari. The game works when running on Firefox.

The particular error message that I get when trying to run the project in Safari is: call_indirect to a null table entry (evaluating 'Module["asm"]["Gi"].apply(null,arguments)')

On Safari - desktop:

Screenshot 2020-04-16 at 16 57 58

On Firefox - desktop:

Screenshot 2020-04-16 at 16 58 32

On Chrome - desktop:

Screenshot 2020-04-16 at 17 33 09

On Edge - desktop:

Screenshot 2020-04-16 at 17 35 27

On Opera - desktop:

Screenshot 2020-04-16 at 17 37 10

Steps to reproduce: On macOS, run the game in Safari. It will NOT work. On macOS, run the game in Firefox. It will work. On macOS, run the game in Chrome. It will work. On macOS, run the game in Edge. It will work. On macOS, run the game in Opera. It will work.

Minimal reproduction project: Apocalypse Now.zip

akien-mga commented 4 years ago

Device, version...? Is this Safari 2.0 on an iPod Touch? We have an issue template for a reason.

Please edit your issue to include the content required in the issue template: https://raw.githubusercontent.com/godotengine/godot/master/.github/ISSUE_TEMPLATE/bug_report.md

drmar commented 4 years ago

@akien-mga

I have updated the issue with all the required information, according to the template.

Calinou commented 4 years ago

I think this is a duplicate of #26554.

drmar commented 4 years ago

@Calinou

According to the author of this issue https://github.com/godotengine/godot/issues/26554 his problem is with iOS Safari: "I noticed with GLES2 that html5 exporting is working with Desktop Safari and probably Edge. But I haven't been able to get a project to work with iOS Safari."

The problem that I described is happening on laptop/desktop - macOS. I will post screenshots for more clarity.

Calinou commented 4 years ago

@drmar Nevermind, I read the issue wrong.

drmar commented 4 years ago

I made tests will all major browsers: Safari, Firefox, Chrome, Edge and Opera and posted screenshots as proof. The only browser that doesn't work is Safari. I hope this helps with the debug.

bruvzg commented 4 years ago

Project uploaded it to itch.io fails in Safari with following error, but the same project exported with 3.2.1.stable locally works:

exception thrown: Error: call_indirect to a null table entry (evaluating 'Module["asm"]["Gi"].apply(null,arguments)'),<?>.wasm-function[810]@[wasm code]
    <?>.wasm-function[803]@[wasm code]
    <?>.wasm-function[55416]@[wasm code]
    wasm-stub@[wasm code]
    Gi@[native code]
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:308575
    ccall@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:5556
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:19199
    doCallback@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:59201
    done@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:59287
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:43855
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:45401
    getDB@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:44131
    getRemoteSet@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:45344
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:43805
    getLocalSet@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:45241
    syncfs@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:43732
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:59438
    forEach@[native code]
    syncfs@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:59363
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:19174
    _emscripten_asm_const_iii@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:30447
    wasm-stub@[wasm code]
    <?>.wasm-function[55240]@[wasm code]
    wasm-stub@[wasm code]
    Hi@[native code]
    https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:308662
    callMain@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:7:316629
    synchronousStart@https://v6p9d9t4.ssl.hwcdn.net/html/2129873/Godot_HTML_Test/Apocalypse%20Now.js:211:23
    apply@[native code]
    promiseReactionJob@[native code]
drmar commented 4 years ago

@bruvzg

How did you check locally? I want to try it myself too.

bruvzg commented 4 years ago
Screenshot 2020-04-16 at 22 35 36

There's "Run in browser" button in the editor (HTML5 export should be configured). It will export project and start local web server and open in default browser (you can copy URL and open it in any browser too, server will be active until stopped by the same button).

drmar commented 4 years ago

@bruvzg

I found out in the meantime how to use Python for a quick local server: python -m http.server (http://localhost:8000)

I can also confirm that locally the exported project has no problem in Safari.

Also, if it helps with the debug, a while back I released my first game ever and it was made with Godot 3.1.2.stable I posted the game on kongregate.com, among other places. Here is the link: https://www.kongregate.com/games/Stone_Age_Jazz/arza-adrenaline-rush-zombie-assault?acomplete=arza

Again, in Firefox, Edge, Chrome and Opera it works perfectly. In Safari, it doesn't work at all. The error message is: abort(114). Build with -s ASSERTIONS=1 for more info.

herrnett commented 4 years ago

I just encountered the same problem with my project (https://shanzhai.itch.io/lonely-year).

I tracked the source down, however: It's an issue on itch.io's side. I hosted the exact same project on github pages (herrnett.github.io/Lonely-Year) and it runs without any problems.

drmar commented 4 years ago

@herrnett

It's an issue on itch.io's side.

Are you sure it is itch.io's problem? On other browsers beside Safari the games seem to work just fine.

Please note that the same problem happens on kongregate.com as well for Godot exports, so I am fairly sure it is not itch.io's fault.

herrnett commented 4 years ago

I can only assume since it works when you "run in browser" using godot and it works when hosted on a github page, so the problem must be caused by how itch (and kongregate) handle the files. You are right, though: Of course this could probably be fixed by making the export more "readable" to them.

drmar commented 4 years ago

@herrnett

this could probably be fixed by making the export more "readable" to them.

Not only that, but I remember that before Godot 3.2.1 games didn't work on Safari even locally.

herrnett commented 4 years ago

True. I just wanted to point it out to narrow down what might be causing it. Also its like the first result when one looks up the error on google and I thought it might help people knowing that there is a kind of workaround for this.

Btw: I just put it up on my own place at http://www.herrnett.de/test/ and it works just fine. So to sum it up, using Safari 13.0.5:

Calinou commented 4 years ago

I wonder if this is due to MIME types used to serve the files (or compression, though itch.io doesn't use gzip compression for WASM files).

nice-shot commented 4 years ago

Someone wrote about this issue in reddit: https://www.reddit.com/r/godot/comments/g49alx/issues_when_uploading_on_itchio_html5/

It looks like it's caused by the use of iframe in itch that prevents third-party cookies. Don't know why it causes godot to crash but it can be fixed for a specific iPhone by going to Settings > Safari and disabling Prevent Cross-site Tracking. This makes it work in Safari on iOS but not in other browsers like Chrome.

nice-shot commented 4 years ago

This was fixed for me in 3.2.2 in this: #39538

Calinou commented 4 years ago

Closing as resolved per @nice-shot's comment. Please comment if you can still reproduce this issue in 3.2.2 or any later release.

dijs commented 4 years ago

I got further with 3.2.2, but still having issues in safari.

image