CI: find clang-c/Index.h and libclang where Ubuntu and Homebrew keep them; the language server on Windows paths

CI has failed since the embed merge (2026-10-25):
- Linux: bootstrap/build.sh asks llvm-config for the folder with clang-c/Index.h
- macOS: FINCH_LIBCLANG's -L folders also go to the compiler's own link "clang"
- Windows: the language server turns file:///C:/x into C:/x and back (diagnostics went to /C:/x);
  the -g tests compare without \r; shared.sh (dlopen, -rdynamic) is not run there

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GzNP6r8dg6WDxUVZy8wjL
This commit is contained in:
Nexoniarz 2026-10-29 11:42:18 +01:00
commit 72e96a3f71
4 changed files with 33 additions and 7 deletions

View file

@ -27,8 +27,20 @@ case $seed in windows-*) EXE=.exe ;; esac
CLANG=${FINCH_CLANG:-clang}
LIBS=${FINCH_LIBCLANG:--lclang}
INC=
[ -z "${FINCH_LLVM_INCLUDE:-}" ] || INC="-I $FINCH_LLVM_INCLUDE" # where clang-c/Index.h is, if clang does not find it itself
# where clang-c/Index.h is, if clang does not find it itself (Debian and Ubuntu keep it in /usr/lib/llvm-N/include)
if [ -z "${FINCH_LLVM_INCLUDE:-}" ] && command -v llvm-config > /dev/null 2>&1 \
&& [ -f "$(llvm-config --includedir)/clang-c/Index.h" ]; then
FINCH_LLVM_INCLUDE=$(llvm-config --includedir)
fi
[ -z "${FINCH_LLVM_INCLUDE:-}" ] || INC="-I $FINCH_LLVM_INCLUDE"
export FINCH_RT=$PWD/runtime/finch_rt.c
# the -L folders of FINCH_LIBCLANG are where the compiler's own link "clang" is found too
if [ -z "${FINCH_LDFLAGS:-}" ]; then
for w in $LIBS; do
case $w in -L*) FINCH_LDFLAGS="${FINCH_LDFLAGS:-} $w" ;; esac
done
[ -z "${FINCH_LDFLAGS:-}" ] || export FINCH_LDFLAGS
fi
# Windows: libclang.dll has to sit next to the programs that use it (FINCH_LIBCLANG is then the path of that dll)
if [ -n "$EXE" ]; then cp "$LIBS" build/; fi