emscripten-core / emscripten-core/emscripten

"Unexpected arg0 type (select)" for EM_ASM call

Open
#11,539 10 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I have previously compiling code not working after `git pull` and activating the `latest` emsdk (1.39.18). The error is:

> "Fatal: Unexpected arg0 type (select) in call to: emscripten_asm_const_int_sync_on_main_thread"

There are several EM_ASM calls, some returning an int and not. Commenting them out one by one revealed the call it was complaining about was this one (where `utf8` is a `const char *`):

MAIN_THREAD_EM_ASM(
{ (1,eval)(UTF8ToString($0)) },
utf8
);

Changing this to simply `{ eval(UTF8ToString($0)) }` gets it to compile. However, that doesn't achieve the purpose... which was to achieve an ["indirect eval call"](http://perfectionkills.com/global-eval-what-are-the-options/#indirect_eval_call_theory).

Changing it to a plain EM_ASM (no MAIN_THREAD) also seems to work, but also does not accomplish the intent.

Command line

> `emcc -shared -o libr3.js -static-libgcc -Os -s ENVIRONMENT='web,worker' -s ASSERTIONS=1 --closure 0 --minify 0 --post-js prep/include/reb-lib.js -s DISABLE_EXCEPTION_CATCHING=1 -s DEMANGLE_SUPPORT=0 -s EXPORTED_FUNCTIONS=@prep/include/libr3.exports.json -s "EXTRA_EXPORTED_RUNTIME_METHODS=['allocateUTF8']" -s WASM=1 -s SAFE_HEAP=0 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=1` (...bunch of obj files...)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.