WebAssembly / WebAssembly/wasi-sdk
Building the clangd LSP
Nobody has claimed this yet.
- Dominant language
- CMake
- Stars
- 1.6k
- Forks
- 237
- Avg merge
- 18h 26m
- Merged PRs (30d)
- 5
Description
I'm running into trouble when trying to build the clangd language server protocol using wasi-sdk on macOS 15.
I'm using the following script:
#!/bin/bash
set -e -o pipefail
export PATH="$HOME/opt/wasi-sdk-27.0-arm64-macos:$PATH"
export WASI_SDK_PATH="$HOME/opt/wasi-sdk-27.0-arm64-macos"
export WASI_TOOLCHAIN_FILE="${WASI_SDK_PATH}/share/cmake/wasi-sdk.cmake"
cd /tmp
rm -rf build-wasm
mkdir -p build-wasm
cd build-wasm
cmake -G "Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE="${WASI_TOOLCHAIN_FILE}" \
-DCMAKE_SYSROOT="${WASI_SDK_PATH}/share/wasi-sysroot" \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" \
-DLLVM_INCLUDE_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$HOME/clangd-wasi" \
-DCMAKE_CXX_FLAGS="-fno-exceptions" \
-DLLVM_TARGETS_TO_BUILD="WebAssembly" \
-DLLVM_DEFAULT_TARGET_TRIPLE="wasm32-wasi" \
../llvm-project-llvmorg-21.1.3/llvm
make -j8 clangd
When running cmake, I am stuck on the following error:
-- LLVM default target triple: wasm32-wasi
CMake Error at cmake/modules/HandleLLVMOptions.cmake:245 (MESSAGE):
Unable to determine platform
Call Stack (most recent call first):
CMakeLists.txt:1086 (include)
Unfortunately, I am not familiar enough with cmake to know what to try next to debug this problem. Any suggestions?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied CMake invocation, then read cmake/modules/HandleLLVMOptions.cmake around line 245 and the call from CMakeLists.txt:1086. Determine why platform detection fails for the wasm32-wasi configuration and confirm that configuration can proceed far enough to build clangd.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, wasm
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100