WebAssembly / WebAssembly/wasi-sdk

relocation R_WASM_MEMORY_ADDR_TLS_SLEB cannot be used against an undefined symbol `__wasm_lpad_context`

Open
#541 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CMake
Stars
1.6k
Forks
237
Avg merge
18h 26m
Merged PRs (30d)
5

Description

Hello all, I am trying to compile a large C++ codebase to WASM.
Exception handling (throw, catch) is being used, as well as pthreads.

I am compiling the code with WASI SDK 24.0 release using these flags:

```
-DCMAKE_C_COMPILER="/opt/wasi-sdk/bin/clang" -DCXX_EXTRA="-Oz -g" -DCMAKE_CXX_COMPILER="/opt/wasi-sdk/bin/clang++" \
-DCMAKE_CXX_FLAGS="--target=wasm32-wasi-threads -pthread -fwasm-exceptions \
-gpubnames -D_WASI_EMULATED_PROCESS_CLOCKS -lwasi-emulated-process-clocks -D_WASI_EMULATED_SIGNAL \
-lwasi-emulated-signal -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_GETPID -lwasi-emulated-getpid -Wno-everything \
-Wl,-z,stack-size=16777216 -Wl,--initial-memory=33554432,--no-check-features"  \
 -DCMAKE_C_FLAGS="--target=wasm32-wasi-threads -pthread -fwasm-exceptions" && \

As you can see, I am using -fwasm-exceptions and -pthread flags, nevertheless I am getting a compiling error:

`relocation R_WASM_MEMORY_ADDR_TLS_SLEB cannot be used against an undefined symbol `__wasm_lpad_context``

Why is this? I have read in other issues that WASI SDK should have exception handling support by now.

Thanks for your help.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported build with WASI SDK 24.0 using the supplied CMake flags, especially -fwasm-exceptions and -pthread. Start from the linker diagnostic for the undefined __wasm_lpad_context symbol and determine whether the toolchain supports this combination; done means identifying the cause and documenting a confirmed compatible configuration or limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, wasm
Domain
build-system, compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.