Skip to content

Commit 0fa0cca

Browse files
committed
Back out "Bump to clang 20 (alisw#5988)"
Original commit changeset: 3e7f035
1 parent 595c3f2 commit 0fa0cca

File tree

3 files changed

+29
-42
lines changed

3 files changed

+29
-42
lines changed

clang.sh

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package: Clang
2-
version: "v20.1.7"
3-
tag: "llvmorg-20.1.7-alice2"
2+
version: "v18.1.8"
3+
tag: "llvmorg-18.1.8-alice2"
44
source: https://github.com/alisw/llvm-project-reduced
55
requires:
66
- "GCC-Toolchain:(?!osx)"
@@ -53,14 +53,13 @@ cmake "$SOURCEDIR/llvm" \
5353
-DLLVM_BUILD_LLVM_DYLIB=ON \
5454
-DLLVM_ENABLE_RTTI=ON \
5555
-DBUILD_SHARED_LIBS=OFF \
56-
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF
57-
56+
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
57+
${GCC_TOOLCHAIN_ROOT:+-DGCC_INSTALL_PREFIX=$GCC_TOOLCHAIN_ROOT}
58+
5859
cmake --build . -- ${JOBS:+-j$JOBS} install
5960

6061
if [[ $PKGVERSION == v18.1.* ]]; then
6162
SPIRV_TRANSLATOR_VERSION="v18.1.3"
62-
elif [[ $PKGVERSION == v20.1.* ]]; then
63-
SPIRV_TRANSLATOR_VERSION="v20.1.3"
6463
else
6564
SPIRV_TRANSLATOR_VERSION="${PKGVERSION%%.*}.0.0"
6665
fi
@@ -105,28 +104,12 @@ mv "$INSTALLROOT"/bin/git-clang* "$INSTALLROOT/bin-safe/" # we also need git-cl
105104
sed -i.bak -e "s|bin/clang|bin-safe/clang|g" "$INSTALLROOT/lib/cmake/clang/ClangTargets-release.cmake"
106105
rm "$INSTALLROOT"/lib/cmake/clang/*.bak
107106

108-
# Allow clang to find our own GCC. Notice the cat does not expand variables because
109-
# we want to resolve the environment when we run, not when we build this, to avoid
110-
# relocation issues in case GCC and clang are not built at the same time.
111-
if [ ! "X$GCC_TOOLCHAIN_ROOT" = X ]; then
112-
cat > "$INSTALLROOT/bin-safe/$(clang --print-target-triple)-clang++.cfg" << \EOF
113-
--gcc-toolchain=$GCC_TOOLCHAIN_ROOT
114-
EOF
115-
cat > "$INSTALLROOT/bin-safe/$(clang --print-target-triple)-clang.cfg" << \EOF
116-
--gcc-toolchain=$GCC_TOOLCHAIN_ROOT
117-
EOF
118-
cat > "$INSTALLROOT/bin-safe/$(clang --print-target-triple)-clang-cpp.cfg" << \EOF
119-
--gcc-toolchain=$GCC_TOOLCHAIN_ROOT
120-
EOF
121-
fi
122-
123107
# Check it actually works
124108
cat << \EOF > test.cc
125109
#include <iostream>
126110
EOF
127111
"$INSTALLROOT/bin-safe/clang++" -v -c test.cc
128112

129-
130113
# Modulefile
131114
mkdir -p etc/modulefiles
132115
cat > "etc/modulefiles/$PKGNAME" <<EoF

o2checkcode.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ cp "${O2_ROOT}"/compile_commands.json .
1616
# We will try to setup a list of files to be checked by using 2 specific Git commits to compare
1717

1818
# Heuristically guess source directory
19-
2019
O2_SRC=$(python3 -c 'import json, os; print(os.path.commonpath([x["file"] for x in json.loads(open("compile_commands.json").read()) if "sw/BUILD" not in x["file"] and "G__" not in x["file"] and x["file"].endswith(".cxx")]))')
21-
[[ -e "$O2_SRC"/CMakeLists.txt ]]
20+
[[ -e "$O2_SRC"/CMakeLists.txt && -d "$O2_SRC"/.git ]]
2221

2322
# We have something to compare our working directory to (ALIBUILD_BASE_HASH). We check only the
2423
# changed files (including the untracked ones) if the list of relevant files that changed is up to
2524
# 50 entries long
2625
if [[ $ALIBUILD_BASE_HASH ]]; then
2726
pushd "$O2_SRC"
28-
[[ -d .git ]]
2927
( git diff --name-only $ALIBUILD_BASE_HASH${ALIBUILD_HEAD_HASH:+...$ALIBUILD_HEAD_HASH} || true ; git ls-files --others --exclude-standard ) | ( grep -E '\.cxx$|\.h$' || true ) | sort -u > $BUILDDIR/changed
3028
if [[ $(cat $BUILDDIR/changed | wc -l) -le 50 ]]; then
3129
O2_CHECKCODE_CHANGEDFILES=$(while read FILE; do [[ -e "$O2_SRC/$FILE" ]] && echo "$FILE" || true; done < <(cat $BUILDDIR/changed) | \
@@ -64,13 +62,11 @@ CHECKS="${O2_CHECKER_CHECKS:--*\
6462
,readability-braces-around-statements\
6563
}"
6664

67-
echo $CHECKS
68-
$CLANG_ROOT/bin-safe/clang-tidy --load $O2CODECHECKER_ROOT/lib/libclangTidyAliceO2Module.so --list-checks -checks="*"
6965
# Run C++ checks
7066
run_O2CodeChecker.py ${JOBS+-j $JOBS} \
71-
-clang-tidy-binary $CLANG_ROOT/bin-safe/clang-tidy \
67+
-clang-tidy-binary $(which O2codecheck) \
7268
-clang-apply-replacements-binary "$CLANG_ROOT/bin-safe/clang-apply-replacements" \
73-
-extra-args="--load $O2CODECHECKER_ROOT/lib/libclangTidyAliceO2Module.so ${GCC_TOOLCHAIN_REVISION:+--extra-arg=--gcc-install-dir=$(find \"$GCC_TOOLCHAIN_ROOT/lib\" -name crtbegin.o -exec dirname {} \;)}" \
69+
${GCC_TOOLCHAIN_REVISION:+-extra-args="--extra-arg=--gcc-install-dir=`find "$GCC_TOOLCHAIN_ROOT/lib" -name crtbegin.o -exec dirname {} \;`"} \
7470
-header-filter='.*SOURCES(?!.*/3rdparty/).*' \
7571
${O2_CHECKER_FIX:+-fix} -checks="$CHECKS" 2>&1 | tee error-log.txt
7672

o2codechecker.sh

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
11
package: o2codechecker
2-
version: v20.1.7
3-
tag: v20.1.7
2+
version: v18.1.2
3+
tag: v18.1.2
44
requires:
55
- Clang:(?!osx*)
66
build_requires:
77
- CMake
8-
- alibuild-recipe-tools
9-
- ninja
108
source: https://github.com/AliceO2Group/O2CodeChecker.git
119
incremental_recipe: |
12-
cmake --build . -- ${JOBS:+-j$JOBS} install
10+
make ${JOBS+-j$JOBS} install
1311
mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles
1412
---
1513
#!/bin/bash -e
1614
case $ARCHITECTURE in
1715
osx*)
18-
# use compatible llvm@20 from brew, if available. This
16+
# use compatible llvm@18 from brew, if available. This
1917
# must match the prefer_system_check in clang.sh
20-
CLANG_ROOT=`brew --prefix llvm@20`
18+
CLANG_ROOT=`brew --prefix llvm@18`
2119
;;
2220
*) ;;
2321
esac
24-
cmake $SOURCEDIR -G Ninja \
25-
-DCMAKE_INSTALL_PREFIX=$INSTALLROOT \
22+
cmake $SOURCEDIR -DCMAKE_INSTALL_PREFIX=$INSTALLROOT \
2623
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
2724
-DClang_DIR=$CLANG_ROOT/lib/cmake/clang \
2825
-DLLVM_DIR=$CLANG_ROOT/lib/cmake/llvm
29-
cmake --build . -- ${JOBS:+-j$JOBS} install
26+
make ${JOBS+-j$JOBS} install
3027
ctest
3128

3229
# Modulefile
3330
mkdir -p etc/modulefiles
34-
alibuild-generate-module --bin --lib --cmake > "etc/modulefiles/$PKGNAME"
35-
36-
cat >> "etc/modulefiles/$PKGNAME" <<EoF
31+
cat > etc/modulefiles/$PKGNAME <<EoF
32+
#%Module1.0
33+
proc ModulesHelp { } {
34+
global version
35+
puts stderr "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
36+
}
37+
set version $PKGVERSION-@@PKGREVISION@$PKGHASH@@
38+
module-whatis "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
39+
# Dependencies
40+
module load BASE/1.0 ${CLANG_REVISION:+Clang/$CLANG_VERSION-$CLANG_REVISION}
41+
# Our environment
42+
set O2CODECHECKER_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
3743
setenv O2CODECHECKER_ROOT \$O2CODECHECKER_ROOT
44+
prepend-path PATH \$O2CODECHECKER_ROOT/bin
45+
prepend-path LD_LIBRARY_PATH \$O2CODECHECKER_ROOT/lib
3846
EoF
3947
mkdir -p $INSTALLROOT/etc/modulefiles && rsync -a --delete etc/modulefiles/ $INSTALLROOT/etc/modulefiles

0 commit comments

Comments
 (0)