Skip to content

Commit

Permalink
fix: use only Clang's major version in install prefix
Browse files Browse the repository at this point in the history
Due to [a change] in LLVM, Clang will expect to find the
`libclang_rt.builtins-wasm32.a` file in a path that only contains the
major version (`16`) instead of the entire version (`16.0.0`) as was
previously the case. This change modifies the `CMAKE_INSTALL_PREFIX` to
use Clang's major version only.

[a change]: https://reviews.llvm.org/D125860
  • Loading branch information
abrown committed Mar 20, 2023
1 parent 315799a commit 427fd5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ BASH=
endif

CLANG_VERSION=$(shell $(BASH) ./llvm_version.sh $(LLVM_PROJ_DIR))
CLANG_MAJOR_VERSION=$(shell $(BASH) ./llvm_version_major.sh $(LLVM_PROJ_DIR))
VERSION:=$(shell $(BASH) ./version.sh)
DEBUG_PREFIX_MAP=-fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION)

Expand Down Expand Up @@ -134,7 +135,7 @@ build/compiler-rt.BUILT: build/llvm.BUILT build/wasi-libc.BUILT
-DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP)" \
-DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \
-DCOMPILER_RT_OS_DIR=wasi \
-DCMAKE_INSTALL_PREFIX=$(PREFIX)/lib/clang/$(CLANG_VERSION)/ \
-DCMAKE_INSTALL_PREFIX=$(PREFIX)/lib/clang/$(CLANG_MAJOR_VERSION)/ \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
$(LLVM_PROJ_DIR)/compiler-rt/lib/builtins
DESTDIR=$(DESTDIR) ninja $(NINJA_FLAGS) -C build/compiler-rt install
Expand Down
4 changes: 4 additions & 0 deletions llvm_version_major.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
LLVM_PROJ_DIR=${1:-./src/llvm-project}
MAJOR=`grep "set(LLVM_VERSION_MAJOR" $LLVM_PROJ_DIR/llvm/CMakeLists.txt | awk '{print substr($2, 1, length($2) - 1)}'`
echo $MAJOR

0 comments on commit 427fd5d

Please sign in to comment.