<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/72771>72771</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
How to build libunwind for wasm?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
trcrsired
</td>
</tr>
</table>
<pre>
error: "Unsupported architecture."
`[14/16] Building CXX object src/CMakeFiles/unwind_static_objects.dir/libunwind.cpp.obj
FAILED: src/CMakeFiles/unwind_static_objects.dir/libunwind.cpp.obj
/home/cqwrteur/llvm_toolchains/x86_64-pc-linux-gnu/bin/clang++ --target=wasm32-wasi --sysroot=/home/cqwrteur/toolchains/sysroots/wasm32-wasi/wasm32-wasi -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBUNWIND_IS_BAREMETAL -I/home/cqwrteur/projects/llvm-project/libunwind/include -Wno-array-bounds -Wno-cast-function-type -Wno-uninitialized -fuse-ld=lld -Wno-misleading-indentation -Wno-global-constructors -Wno-unused-command-line-argument -O3 -DNDEBUG -std=c++11 -Werror=return-type -funwind-tables -nostdinc++ -D_DEBUG -UNDEBUG -D_LIBUNWIND_IS_NATIVE_ONLY -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -pedantic -fno-rtti -fstrict-aliasing -fno-exceptions -fno-rtti -MD -MT src/CMakeFiles/unwind_static_objects.dir/libunwind.cpp.obj -MF src/CMakeFiles/unwind_static_objects.dir/libunwind.cpp.obj.d -o src/CMakeFiles/unwind_static_objects.dir/libunwind.cpp.obj -c /home/cqwrteur/projects/llvm-project/libunwind/src/libunwind.cpp
In file included from /home/cqwrteur/projects/llvm-project/libunwind/src/libunwind.cpp:12:
In file included from /home/cqwrteur/projects/llvm-project/libunwind/include/libunwind.h:16:
/home/cqwrteur/projects/llvm-project/libunwind/include/__libunwind_config.h:184:4: error: "Unsupported architecture."
184 | # error "Unsupported architecture."
| ^
In file included from /home/cqwrteur/projects/llvm-project/libunwind/src/libunwind.cpp:12:
/home/cqwrteur/projects/llvm-project/libunwind/include/libunwind.h:71:17: error: use of undeclared identifier '_LIBUNWIND_CONTEXT_SIZE'
71 | uint64_t data[_LIBUNWIND_CONTEXT_SIZE];
| ^
/home/cqwrteur/projects/llvm-project/libunwind/include/libunwind.h:76:17: error: use of undeclared identifier '_LIBUNWIND_CURSOR_SIZE'
76 | uint64_t data[_LIBUNWIND_CURSOR_SIZE];
| ^
In file included from /home/cqwrteur/projects/llvm-project/libunwind/src/libunwind.cpp:30:
In file included from /home/cqwrteur/projects/llvm-project/libunwind/src/AddressSpace.hpp:23:
In file included from /home/cqwrteur/projects/llvm-project/libunwind/src/EHHeaderParser.hpp:17:
/home/cqwrteur/projects/llvm-project/libunwind/src/DwarfParser.hpp:69:26: error: use of undeclared identifier '_LIBUNWIND_HIGHEST_DWARF_REGISTER'
69 | kMaxRegisterNumber = _LIBUNWIND_HIGHEST_DWARF_REGISTER
| ^
In file included from /home/cqwrteur/projects/llvm-project/libunwind/src/libunwind.cpp:31:
In file included from /home/cqwrteur/projects/llvm-project/libunwind/src/UnwindCursor.hpp:50:
/home/cqwrteur/projects/llvm-project/libunwind/src/RWMutex.hpp:19:10: fatal error: 'pthread.h' file not found
19 | #include <pthread.h>
| ^~~~~~~~~~~
5 errors generated.
ninja: build stopped: subcommand failed.`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEV11z4joS_TXiRSXKH2DCAw8QmwlVA5kCsszdF5cstY3mCskryZfMPuxv35JtmDB3pu7uJpl1VXBsdZ_T3afdtqi1olIAMzReoHE6oI07ajNzhhkrDPBBofnXGRijDYrnGEXRk7JNXWvjgGNq2FE4YK4xMERRhIIUBfP-Nw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