<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114223>114223</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Doubts regarding compiling llvm (clang, lld) to wasm
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
anutosh491
</td>
</tr>
</table>
<pre>
I see this
https://github.com/llvm/llvm-project/blob/e8b95a02bff8498c888ed5e85d0197ec82b95cd6/clang/lib/Interpreter/CMakeLists.txt#L1-L48
Well this generates the following link.txt
```
│ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/emar qc ../../../../lib/libclangInterpreter.a CMakeFiles/obj.clangInterpreter.dir/DeviceOffload.cpp.o CMakeFile
│ │ s/obj.clangInterpreter.dir/CodeCompletion.cpp.o CMakeFiles/obj.clangInterpreter.dir/IncrementalExecutor.cpp.o CMakeFiles/obj.clangInterpreter.dir/Increment
│ │ alParser.cpp.o CMakeFiles/obj.clangInterpreter.dir/Interpreter.cpp.o CMakeFiles/obj.clangInterpreter.dir/InterpreterUtils.cpp.o CMakeFiles/obj.clangInterpr
│ │ eter.dir/Value.cpp.o CMakeFiles/obj.clangInterpreter.dir/Wasm.cpp.o
│ │ $BUILD_PREFIX/opt/emsdk/upstream/emscripten/emranlib ../../../../lib/libclangInterpreter.a
```
Here I can see the source file object being used .
But i am not able to understand the linking between `clangInterpreter` and the other link_libs (like `clangAST`) and components (like for eg `Support`)
I am working on a very similar structure where there are
1) llvm components
2) static libraries generated when compiling against wasm (like libclangInterpreter.a)
3) There are source files
So I need to compile my project (let's say libXX.a) .
I am using the similar mechanism as above (only `add_llvm_library` instead of `add_clang_library`)
So when I build xx against emscripten, I end up getting lot of undefined symbols (which are supposed to be provided by the static libraries like libclangInterpreter.a) .... which tells me that the linking against the static libraries and components is not taking place as expected.
Hence if I understand how the above works I shall try to replicate it for my usecase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