Skip to content

Unable to run wasm in iPhone SE with iOS 14.7. #23612

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

Open
hardik124 opened this issue Feb 6, 2025 · 10 comments
Open

Unable to run wasm in iPhone SE with iOS 14.7. #23612

hardik124 opened this issue Feb 6, 2025 · 10 comments

Comments

@hardik124
Copy link

I have a wasm which is singlethreaded and with SIMD disabled.
It runs on other iPhones but we are encountering a problem that it does not compile on iPhone SE.
The error we get is : RuntimeError: Aborted(CompileError: WebAssembly.Module doesn't parse at byte 92417: "references are not enabled"
I am not able to find why this error comes. This is a debug build with Assertions enabled.

I know Wasm is not wrong because it works on other devices. Any help would be appreciated.
Thanks

@sbc100
Copy link
Collaborator

sbc100 commented Feb 6, 2025

Can you attach the offending wasm file?

Also, using wasm-dis to disassembly it might give you a clue as to how references crept in. I don't think emscripten itself generates any uses of reference types yet.

@sbc100 sbc100 transferred this issue from emscripten-core/emsdk Feb 6, 2025
@hardik124
Copy link
Author

Hey @sbc100 , apologies, but i am not allowed to share the wasm file .
Could you guide me what references are ? And its weird that this file works on iPhone SE2,13,14,15 but not on SE

@sbc100
Copy link
Collaborator

sbc100 commented Feb 6, 2025

I imagine that references are not enabled is safari's way of saying that you have a reference type in your code.

What version of safari is running the device? The default minimum version of safari that we generated output for is v15. If you are targeting a version of safari older than that you can use -sMIN_SAFARI_VERSION=14000 (for example, to target safari v14)

@hardik124
Copy link
Author

Hey @sbc100 I did make -sMIN_SAFARI_VERSION=12000 But that did not help.
Even tried with -sMIN_SAFARI_VERSION=14000.

@hardik124
Copy link
Author

does "references" mean what i think it means? When we pass a variable by reference using "&" ? Because i have loads of those in my code.

@sbc100
Copy link
Collaborator

sbc100 commented Feb 7, 2025

No, it has nothing to do with C++ or & in your code.

What version of safari is running on the device that rejects the binary?

@hardik124
Copy link
Author

It is 14.7.1.
I have a different code base which builds with 3.1.4 emsdk, and it works fine.
but this code base i have tried using even 3.1.25 and i get same error.

@sbc100
Copy link
Collaborator

sbc100 commented Feb 10, 2025

Interesting, so 3.1.25 itself is more than 2 years old, so I'm somewhat supprised that it wouldn't work with Safari 14.

Can you try building with the very latest version of emscripten (4.0.3) with -sMIN_SAFARI_VERSION=14000?

@hardik124
Copy link
Author

build fail with 4.0.3 with error
[ 15%] Built target pdfium_core_fxcrt
In file included from /wrk/build_wasm/_deps/zxing-cpp-src/core/src/Utf.cpp:8:
In file included from /wrk/build_wasm/_deps/zxing-cpp-src/core/src/Utf.h:8:
In file included from /emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/string:647:
/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/string_view:300:42: error: implicit instantiation of undefined template 'std::char_traits'
300 | static_assert(is_same<_CharT, typename traits_type::char_type>::value,
| ^
/wrk/build_wasm/_deps/zxing-cpp-src/core/src/Utf.cpp:72:42: note: in instantiation of template class 'std::basic_string_view' requested here
72 | static size_t Utf8CountCodePoints(utf8_t utf8)
| ^
/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here
45 | struct char_traits;

On one of the imported library i have (ZXing). And it would require me to modify that library to build it. Any other version can i try with ? PReviously i was setting sMIN_SAFARI_VERSION=12000

@sbc100
Copy link
Collaborator

sbc100 commented Feb 13, 2025

The compilation failure looks related to recent changes to libc++ regarding std::string. See #23070.

Regarding the error you are seeing on the phone, can you find out what is at the offset in your wasm binary? i.e. what is at offset 92417 from the error RuntimeError: Aborted(CompileError: WebAssembly.Module doesn't parse at byte 92417: "references are not enabled"?

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