From adef23bc03ec3bab17f7b988bec727dbd326b564 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 8 Feb 2023 10:09:27 -0800 Subject: [PATCH] fix: use only Clang's major version in install prefix 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 --- Makefile | 3 ++- llvm_version_major.sh | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 llvm_version_major.sh diff --git a/Makefile b/Makefile index 761ccbb..63f4ca7 100644 --- a/Makefile +++ b/Makefile @@ -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) @@ -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 diff --git a/llvm_version_major.sh b/llvm_version_major.sh new file mode 100755 index 0000000..2e5d973 --- /dev/null +++ b/llvm_version_major.sh @@ -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