Skip to content
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

INCOMING_MODULE_JS_API requires attributes that aren't used #21167

Open
emaxx-google opened this issue Jan 24, 2024 · 2 comments
Open

INCOMING_MODULE_JS_API requires attributes that aren't used #21167

emaxx-google opened this issue Jan 24, 2024 · 2 comments

Comments

@emaxx-google
Copy link

Please include the following in your bug report:

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.52 (fa478400df3351f7153c0279bc638784d3d90334)
clang version 18.0.0git (https://github.com/llvm/llvm-project 0a3a0ea5914cb4633f4f4c14f1ddc46ce067061a)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/env/emsdk/upstream/bin

Failing command line in full:
The error is at run time, when running the result under Node:

Aborted(`Module.wasmMemory` was supplied but `wasmMemory` not included in INCOMING_MODULE_JS_API)
worker.js onmessage() captured an uncaught exception: RuntimeError: Aborted(`Module.wasmMemory` was supplied but `wasmMemory` not included in INCOMING_MODULE_JS_API)
/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:656
 throw e;
 ^

RuntimeError: Aborted(`Module.wasmMemory` was supplied but `wasmMemory` not included in INCOMING_MODULE_JS_API)
    at abort (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:655:40)
    at ignoredModuleProp (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:799:3)
    at checkIncomingModuleAPI (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:6243:2)
    at /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:267:1
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at importScripts (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:44:30)
    at handleMessage (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:137:9)
    at MessagePort.<anonymous> (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:29:38)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
Pthread 0x00139018 sent an error! undefined:undefined: Aborted(`Module.wasmMemory` was supplied but `wasmMemory` not included in INCOMING_MODULE_JS_API)

Full link command and output with -v appended:

emcc -o ./out-artifacts-emscripten/Debug/cpp_unit_test_runner.js -L../../../../env/emsdk/lib/Debug ./out-artifacts-emscripten/Debug/__/__/src/public/formatting_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/ipc_emulation_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/join_string_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/logging/hex_dumping_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/logging/logging_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/messaging/typed_message_router_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/multi_string_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/numeric_conversions_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/requesting/async_request_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/requesting/async_requests_storage_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/requesting/remote_call_arguments_conversion_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_builder_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_conversion_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_debug_dumping_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_emscripten_val_conversion_unittest.o -lgoogle_smart_card_common -lgtest_main -lgmock -lgtest -pthread -s DISABLE_EXCEPTION_CATCHING=0  -O0 -g  --bind --post-js=../../../../common/js/src/executable-module/emscripten-module-js-epilog.js.inc -s ABORTING_MALLOC=1 -s ALLOW_MEMORY_GROWTH=1 -s DYNAMIC_EXECUTION=0 -s ENVIRONMENT=web,worker -s 'EXPORT_NAME="loadEmscriptenModule_cpp_unit_test_runner"' -s INCOMING_MODULE_JS_API=[onAbort,print,printErr] -s MIN_CHROME_VERSION=96 -s MIN_EDGE_VERSION=-1 -s MIN_FIREFOX_VERSION=-1 -s MIN_IE_VERSION=-1 -s MIN_SAFARI_VERSION=-1 -s MODULARIZE=1 -s PTHREAD_POOL_SIZE_STRICT=0 -s TOTAL_STACK=1048576 -Wno-pthreads-mem-growth -v  -s ASSERTIONS=2 -s DEMANGLE_SUPPORT=1 -s SAFE_HEAP=1 -Wno-limited-postlink-optimizations   -s ENVIRONMENT=node -s EXIT_RUNTIME -s EXPORT_NAME=Module -s MODULARIZE=0 -s PROXY_TO_PTHREAD
 /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/env/emsdk/upstream/bin/clang --version
 /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/env/emsdk/upstream/bin/wasm-ld -o ./out-artifacts-emscripten/Debug/cpp_unit_test_runner.wasm -L../../../../env/emsdk/lib/Debug ./out-artifacts-emscripten/Debug/__/__/src/public/formatting_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/ipc_emulation_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/join_string_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/logging/hex_dumping_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/logging/logging_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/messaging/typed_message_router_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/multi_string_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/numeric_conversions_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/requesting/async_request_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/requesting/async_requests_storage_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/requesting/remote_call_arguments_conversion_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_builder_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_conversion_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_debug_dumping_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_unittest.o ./out-artifacts-emscripten/Debug/__/__/src/public/value_emscripten_val_conversion_unittest.o ../../../../env/emsdk/lib/Debug/libgoogle_smart_card_common.a ../../../../env/emsdk/lib/Debug/libgtest_main.a ../../../../env/emsdk/lib/Debug/libgmock.a ../../../../env/emsdk/lib/Debug/libgtest.a -L/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/env/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/env/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/crtbegin.o /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/env/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/crt1_proxy_main.o --whole-archive -lembind-rtti --no-whole-archive -lGL-mt-getprocaddr -lal -lhtml5 -lbulkmemory -lstubs-debug -lc-mt-debug -ldlmalloc-mt-debug -lcompiler_rt-mt -lc++-mt -lc++abi-debug-mt -lsockets-mt -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmp1tppxogglibemscripten_js_symbols.so --import-memory --shared-memory --export=_emscripten_thread_init --export=_emscripten_thread_exit --export=_emscripten_thread_crashed --export=_emscripten_tls_init --export=pthread_self --export=_embind_initialize_bindings --export=__get_exception_message --export=free --export=sbrk --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=__cxa_demangle --export=free --export=stackAlloc --export=stackSave --export=stackRestore --export=emscripten_get_sbrk_ptr --export=_emscripten_thread_free_data --export=emscripten_main_runtime_thread_id --export=emscripten_main_thread_process_queued_calls --export=_emscripten_run_on_main_thread_js --export=emscripten_stack_set_limits --export=__get_temp_ret --export=__set_temp_ret --export=__funcs_on_exit --export=__cxa_is_pointer_type --export=__cxa_can_catch --export=__cxa_increment_exception_refcount --export=__cxa_decrement_exception_refcount --export=setThrew --export=__cxa_free_exception --export=__wasm_call_ctors --export=_emscripten_thread_init --export=_emscripten_thread_exit --export=__get_exception_message --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=1048576 --initial-memory=16777216 --max-memory=2147483648 --entry=_emscripten_proxy_main --stack-first --table-base=1

cpp_unit_test_runner.zip

@emaxx-google
Copy link
Author

(This is a similar report to #20636, but IIUC the synthetic minified repro there didn't look compelling, so here I'm attaching a real-world program with all the flags I've been using.)

@emaxx-google
Copy link
Author

  • If I then add wasmMemory to INCOMING_MODULE_JS_API, it fails at runtime with a different error:
Aborted(`Module.buffer` was supplied but `buffer` not included in INCOMING_MODULE_JS_API)
worker.js onmessage() captured an uncaught exception: RuntimeError: Aborted(`Module.buffer` was supplied but `buffer` not included in INCOMING_MODULE_JS_API)
/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:658
 throw e;
 ^

RuntimeError: Aborted(`Module.buffer` was supplied but `buffer` not included in INCOMING_MODULE_JS_API)
    at abort (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:657:40)
    at ignoredModuleProp (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:801:3)
    at checkIncomingModuleAPI (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:6246:2)
    at /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:267:1
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at importScripts (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:44:30)
    at handleMessage (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:137:9)
    at MessagePort.<anonymous> (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:29:38)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
Pthread 0x00139018 sent an error! undefined:undefined: Aborted(`Module.buffer` was supplied but `buffer` not included in INCOMING_MODULE_JS_API)
  • Then after adding buffer to INCOMING_MODULE_JS_API it fails with:
Aborted(`Module.instantiateWasm` was supplied but `instantiateWasm` not included in INCOMING_MODULE_JS_API)
worker.js onmessage() captured an uncaught exception: RuntimeError: Aborted(`Module.instantiateWasm` was supplied but `instantiateWasm` not included in INCOMING_MODULE_JS_API)
/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:658
 throw e;
 ^

RuntimeError: Aborted(`Module.instantiateWasm` was supplied but `instantiateWasm` not included in INCOMING_MODULE_JS_API)
    at abort (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:657:40)
    at ignoredModuleProp (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:801:3)
    at checkIncomingModuleAPI (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:6252:2)
    at /usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.js:267:1
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at importScripts (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:44:30)
    at handleMessage (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:137:9)
    at MessagePort.<anonymous> (/usr/local/google/home/emaxx/smartcard/smart-card-connector-github/common/cpp/build/tests/out/cpp_unit_test_runner/cpp_unit_test_runner.worker.js:29:38)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
Pthread 0x00139018 sent an error! undefined:undefined: Aborted(`Module.instantiateWasm` was supplied but `instantiateWasm` not included in INCOMING_MODULE_JS_API)

emaxx-google added a commit to GoogleChromeLabs/chromeos_smart_card_connector that referenced this issue Jan 24, 2024
This flag is broken in recent Emscripten versions: see
emscripten-core/emscripten#21167 and
emscripten-core/emscripten#20457.

Stop using it until it gets fixed in Emscripten.
emaxx-google added a commit to GoogleChromeLabs/chromeos_smart_card_connector that referenced this issue Jan 24, 2024
This flag is broken in recent Emscripten versions: see
emscripten-core/emscripten#21167 and
emscripten-core/emscripten#20457.

Stop using it until it gets fixed in Emscripten (tracking
issue #1124).
emaxx-google added a commit to GoogleChromeLabs/chromeos_smart_card_connector that referenced this issue Feb 1, 2024
This flag is broken in recent Emscripten versions: see
emscripten-core/emscripten#21167 and
emscripten-core/emscripten#20457.

Stop using it until it gets fixed in Emscripten (tracking
issue #1124).
emaxx-google added a commit to GoogleChromeLabs/chromeos_smart_card_connector that referenced this issue Feb 1, 2024
This flag is broken in recent Emscripten versions: see
emscripten-core/emscripten#21167 and
emscripten-core/emscripten#20457.

Stop using it until it gets fixed in Emscripten (tracking
issue #1124).

We used this flag as a pure optimization, to it's not critical to have
it enabled now.
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
@emaxx-google and others