0

I have been trying to get some C++ code I wrote to be available in the browser using WebAssembly. Infact I had a previous question which I also posted here about a different problem with WASM. I got my code and WebAssembly-Module to work properly on Chrome/Firefox and basically any other browser except on Safari.


Problem description

When loading the website and looking into the console, I am greeted with an error regarding the WASM-module which claims a compile error occured like in the image below:

enter image description here

Furthermore any attempt to use the module does not work because the loaded module ends up being a null-object.


Web resources

I was trying to find a solution to my problem and found the following (possiblity related) websites:

which all claim that its either a safari bug and/or related to SIMD code which I will talk about at the end


WASM Compilation

I am thinking that maybe the way I compiled my code could be problematic. My command to build the wasm-module looks like this:

emcc 
 -O3 
 -std=c++20 
 -DNDEBUG 
 -flto 
 -s TOTAL_MEMORY=4294967296 
 -s ALLOW_MEMORY_GROWTH=1 
 -s INITIAL_MEMORY=33554432 
 -s PROXY_TO_PTHREAD 
 -s NO_EXIT_RUNTIME=1 
 -s "EXPORTED_RUNTIME_METHODS=['ccall']" 
 -msimd128 
 -s MODULARIZE=1 
 -s EXPORT_NAME=FFES 
 -s ENVIRONMENT=web,worker 
 --pre-js ./web_preamble.js 
 -s ASSERTIONS=1 
 -pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -o ./FFES_0.1.js

Note that, due to the 3rd link regarding SIMD in WASM on safari, I have removed all simd code from the program and removed the -msimd128 code without any luck. Removing simd does not solve my problem

I am interested if somebody else had a similar problem and knows if this is actually just a safari bug or what needs to be done to solve this problem. I am very happy for any help or advice.

Finn Eggers
  • 857
  • 8
  • 21

0 Answers0