From fc13a3a5b1c79eb1800ab0119d9f7051b45ba8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 2 Jun 2025 16:01:50 +0300 Subject: [PATCH] build-llvm: Implicitly set LLVM_USE_RELATIVE_PATHS_IN_FILES when using ccache This is an option I set outside of this script in a number of build cases where I build with ccache; move this into the script. In practice it has little effect though; one has to set CCACHE_BASEDIR anyway in order to be able to share a ccache between build directories. If enabling ccache by adding e.g. /usr/lib/ccache to the front of PATH, without using the COMPILER_LAUNCHER variable, this won't get enabled. --- build-llvm.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build-llvm.sh b/build-llvm.sh index 4743ea4..b13bc3b 100755 --- a/build-llvm.sh +++ b/build-llvm.sh @@ -240,6 +240,13 @@ fi if [ -n "$COMPILER_LAUNCHER" ]; then CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER_LAUNCHER=$COMPILER_LAUNCHER" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER_LAUNCHER=$COMPILER_LAUNCHER" + # Make the LLVM build system set options for forcing relative paths + # within the files, e.g. for source file references within assert + # messages. This on its own isn't enough for making the cache reusable + # across different worktrees though; one also needs to set the ccache + # base_dir (CCACHE_BASEDIR) option. When setting that ccache option, this + # option here doesn't really have any effect either, except for debug info. + CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON" fi if [ -n "$LTO" ]; then