emscripten-core / emscripten-core/emscripten
undefined symbol: __cxa_find_matching_catch_2 when mixing wasm and native exception handling
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
`a.cpp`
```c++
#include
#include
void foo()
{
try
{
throw std::runtime_error("asdf");
} catch(const std::exception &e)
{
}
}
```
```
em++ a.cpp -c -o a.o -sDISABLE_EXCEPTION_CATCHING=0
emar rc a.a a.o
```
`main.cpp`
```c++
void foo();
int main()
{
foo();
}
```
```
em++ main.cpp a.a -o a.js -fwasm-exceptions
```
produces
```
C:\emsdk\emscripten\main>em++ main.cpp a.a -o a.js -fwasm-exceptions
cache:INFO: generating system asset: symbol_lists/f6c1c2a3db858f2ea2bded40e96b6bc4eefb0515.json... (this will be cached in "C:\emsdk\emscripten\main\cache\symbol_lists\f6c1c2a3db858f2ea2bded40e96b6bc4eefb0515.json" for subsequent builds)
cache:INFO: - ok
emscripten:ERROR: undefined symbol: __cxa_find_matching_catch_3 (referenced by top-level compiled C/C++ code)
emscripten:ERROR: undefined symbol: __resumeException (referenced by top-level compiled C/C++ code)
emscripten:ERROR: undefined symbol: llvm_eh_typeid_for (referenced by top-level compiled C/C++ code)
```
It is unclear if wasm and native exception handling could be mixed (probably not?), though the above error message does not immediately make it clear to the user why they are getting that error. (imagine a large project, where one or more of hundreds of built files missed the `-fwasm-exceptions` compile flag)
Contributor guide
Assessment
This issue has not been assessed yet.