Hi, I’m trying to use LLVM to build a programming language but I’m having trouble building the project. I already got through the Kaleidoscope example using the version installed on my system (I’m on Archlinux, so LLVM 16.x). But as the project expands I want to have control over which version of LLVM I’m using, so I want to include building it as part of the setup for my compiler. I added a git submodule pointing to the latest commit of the relese/17.x branch, and tried compiling it with:
#!/bin/sh
BUILD_LLVM=`pwd`/build/llvm
INSTALLPFX=`pwd`/build/install
LLVM=`pwd`/libs/llvm-project # Points to the submodule
mkdir -p $BUILD_LLVM $INSTALLPFX
git submodule init
git submodule update --depth 1
cmake -S $LLVM/llvm -B $BUILD_LLVM -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS=all \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_STANDARD=17 \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_INSTALL_PREFIX=$INSTALLPFX
cmake --build $BUILD_LLVM -j8
cmake --build $BUILD_LLVM install
But I’m getting this error:
make: *** [Makefile:156: all] Error 2
-- Install configuration: "Release"
-- Installing: /mnt/data/devel/smplWorks/SmplLang/build/install/lib/libLLVMDemangle.a
CMake Error at build/llvm/lib/Support/cmake_install.cmake:51 (file):
file INSTALL cannot find
"/mnt/data/devel/smplWorks/SmplLang/build/llvm/lib/libLLVMSupport.a": No
such file or directory.
Call Stack (most recent call first):
build/llvm/cmake_install.cmake:52 (include)
What am I doing wrong?
EDIT: The branch release/17.x just got updated and the error got fixed. I’m not sure what I’m doing different but now it works.