Open chrispcampbell opened 4 weeks ago
The reason that I think Sergio had trouble with spaces is because the plugin-wasm docs show this:
Optional
emccArgs: string
[] | () => string
[]
The array of additional arguments to pass to emcc
. If undefined, the plugin will
use the following default set of arguments, which are tuned for (and known to work
with) Emscripten versions 2.0.34 and 3.1.46, among others.
-Wall
-Os
-s STRICT=1
-s MALLOC=emmalloc
-s FILESYSTEM=0
-s MODULARIZE=1
-s SINGLE_FILE=1
-s EXPORT_ES6=1
-s USE_ES6_IMPORT_META=0
-s ENVIRONMENT='web,webview,worker'
-s EXPORTED_FUNCTIONS=['_malloc','_free','_getInitialTime','_getFinalTime','_getSaveper','_setLookup','_runModelWithBuffers']
-s EXPORTED_RUNTIME_METHODS=['cwrap']
When you pass an array of options, the spaces can cause problems if they are included in the strings due to the way args are passed to spawn
. The above docs imply that you'd pass it like this (which I'm assuming how Sergio passed them):
['-s STRICT=1', ...]
But in fact you have to do the -s
part as a separate string, like this:
['-s', 'STRICT=1', ...]
Or just drop the space altogether as Sergio found, and as recommended in the emcc docs:
['-sSTRICT=1', ...]
So I think we can amend the docs and the implementation of plugin-wasm to omit the space for clarity.
Really sorry about that comment. My account got compromised and posted this malicious link. Lessons leaned..
In discussion thread #522, @serman noted an issue with passing
-s
parameters:It's interesting that in many of the Emscripten error messages, they show
-s
arguments with a space, and historically in SDE we have used a space as well, but it looks like the Emscripten documentation was amended at some point to recommend NOT including a space: https://emscripten.org/docs/tools_reference/emcc.html