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

[Web] When performing inference with ONNX Runtime in C++, using the libonnxruntime_webassembly.a static library, but encountering an error during the session.run() call in an HTML5 environment, the error message is: "Uncaught (in promise) 50699072". #19913

Open
TongMeng-AI opened this issue Mar 14, 2024 · 12 comments
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot

Comments

@TongMeng-AI
Copy link

Describe the issue

I want to perform inference using ONNX Runtime in C++, and call it from H5 using JS. Loading the model and outputting model-related information work fine, but I encounter an error during the session.run() operation. I'm not sure what specifically is causing the issue. Could you provide me with some suggestions?

To reproduce

I built libonnxruntime_webassembly.a using the following command:
./build.sh --config Release --build_dir build_wasm --skip_tests --build_wasm_static_lib --enable_wasm_simd --enable_wasm_threads --skip_submodule_sync --allow_running_as_root --disable_wasm_exception_catching --disable_rtti

Urgency

No response

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.17.0

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@TongMeng-AI TongMeng-AI added the platform:web issues related to ONNX Runtime web; typically submitted using template label Mar 14, 2024
@fs-eire
Copy link
Contributor

fs-eire commented Mar 16, 2024

Please remove flag --disable_wasm_exception_catching --disable_rtti and build again. Should show some error message.

@TongMeng-AI
Copy link
Author

Please remove flag --disable_wasm_exception_catching --disable_rtti and build again. Should show some error message.

I recompiled as you suggested and then ran it and got an error specific message as follows:
Uncaught (in promise) RuntimeError: null function or function signature mismatch

@TongMeng-AI
Copy link
Author

image

@TongMeng-AI
Copy link
Author

image

@fs-eire
Copy link
Contributor

fs-eire commented Mar 18, 2024

I didn't see this error before. To further investigate the issue, you may need to add "-s DEMANGLE_SUPPORT=1" in your link flags to check the function names in the stack.

@TongMeng-AI
Copy link
Author

I didn't see this error before. To further investigate the issue, you may need to add "-s DEMANGLE_SUPPORT=1" in your link flags to check the function names in the stack.
According to your suggestion, I added -s DEMANGLE_SUPPORT=1 during compilation, and a warning appeared:
em++: warning: DEMANGLE_SUPPORT is deprecated since mangled names no longer appear in stack traces [-Wdeprecated]

@TongMeng-AI
Copy link
Author

Is there a version correspondence or match between emscripten and onnxruntime?

@fs-eire
Copy link
Contributor

fs-eire commented Mar 19, 2024

we are now using emsdk 3.1.51 in onnxruntime main branch.

@TongMeng-AI
Copy link
Author

we are now using emsdk 3.1.51 in onnxruntime main branch.

I use emsdk 3.1.54,will this have any impact?

@fs-eire
Copy link
Contributor

fs-eire commented Mar 19, 2024

I am not sure. Maybe you can use 3.1.51 to take a try

@TongMeng-AI
Copy link
Author

I am not sure. Maybe you can use 3.1.51 to take a try

Can you provide a simple C++ demo based on ONNX Runtime? I want to test if it can run successfully with libonnxruntime_webassembly.a. Is it possible that there's an error in my C++ inference program?

Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

2 participants