Skip to content

Commit 075581f

Browse files
authored
[clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (llvm#113446)
While building llvm (clang, lld) for wasm using emscripten (recipe hosted on emscripten-forge https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/llvm) I ended up with this error ``` │ │ wasm-ld: error: ../../../../lib/libclangInterpreter.a(Wasm.cpp.o): undefined symbol: lld::wasm::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm: │ │ :raw_ostream&, bool, bool) ``` This is due to the link function here https://github.com/llvm/llvm-project/blob/a4819bd46d8baebc3aaa8b38f78065de33593199/clang/lib/Interpreter/Wasm.cpp#L25-L30 This was added through this PR (llvm#86402) as an attempt to support running clang-repl and executing C++ code interactively inside a Javascript engine using WebAssembly when built with Emscripten. The definition for link is present in lldwasm and when building for the emscripten platform we should be linking against it.
1 parent 2e6d451 commit 075581f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clang/lib/Interpreter/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS
1414

1515
if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS)
1616
set(WASM_SRC Wasm.cpp)
17+
set(WASM_LINK lldWasm)
1718
endif()
1819

1920
add_clang_library(clangInterpreter
@@ -44,6 +45,7 @@ add_clang_library(clangInterpreter
4445
clangParse
4546
clangSema
4647
clangSerialization
48+
${WASM_LINK}
4749
)
4850

4951
if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS)

0 commit comments

Comments
 (0)