@@ -18,7 +18,6 @@ set -o pipefail
1818
1919MONOREPO_ROOT=" ${MONOREPO_ROOT:= " $( git rev-parse --show-toplevel) " } "
2020BUILD_DIR=" ${BUILD_DIR:= ${MONOREPO_ROOT} / build} "
21- INSTALL_DIR=" ${BUILD_DIR} /install"
2221rm -rf " ${BUILD_DIR} "
2322
2423ccache --zero-stats
@@ -28,11 +27,16 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
2827 ccache --clear
2928fi
3029
30+ mkdir -p artifacts/reproducers
31+
32+ # Make sure any clang reproducers will end up as artifacts.
33+ export CLANG_CRASH_DIAGNOSTICS_DIR=` realpath artifacts/reproducers`
34+
3135function at-exit {
3236 retcode=$?
3337
34- mkdir -p artifacts
3538 ccache --print-stats > artifacts/ccache_stats.txt
39+ cp " ${BUILD_DIR} " /.ninja_log artifacts/.ninja_log
3640
3741 # If building fails there will be no results files.
3842 shopt -s nullglob
@@ -49,16 +53,28 @@ trap at-exit EXIT
4953
5054projects=" ${1} "
5155targets=" ${2} "
56+ runtimes=" ${3} "
5257
5358lit_args=" -v --xunit-xml-output ${BUILD_DIR} /test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5459
5560echo " --- cmake"
61+
62+ export PIP_BREAK_SYSTEM_PACKAGES=1
5663pip install -q -r " ${MONOREPO_ROOT} " /mlir/python/requirements.txt
5764pip install -q -r " ${MONOREPO_ROOT} " /lldb/test/requirements.txt
5865pip install -q -r " ${MONOREPO_ROOT} " /.ci/requirements.txt
66+
67+ # Set the system llvm-symbolizer as preferred.
68+ export LLVM_SYMBOLIZER_PATH=` which llvm-symbolizer`
69+ [[ ! -f " ${LLVM_SYMBOLIZER_PATH} " ]] && echo " llvm-symbolizer not found!"
70+
71+ # Set up all runtimes either way. libcxx is a dependency of LLDB.
72+ # If it ends up being unused, not much harm.
5973cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
6074 -D LLVM_ENABLE_PROJECTS=" ${projects} " \
75+ -D LLVM_ENABLE_RUNTIMES=" libcxx;libcxxabi;libunwind" \
6176 -G Ninja \
77+ -D CMAKE_PREFIX_PATH=" ${HOME} /.local" \
6278 -D CMAKE_BUILD_TYPE=Release \
6379 -D LLVM_ENABLE_ASSERTIONS=ON \
6480 -D LLVM_BUILD_EXAMPLES=ON \
@@ -67,69 +83,47 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6783 -D LLVM_ENABLE_LLD=ON \
6884 -D CMAKE_CXX_FLAGS=-gmlt \
6985 -D LLVM_CCACHE_BUILD=ON \
86+ -D LIBCXX_CXX_ABI=libcxxabi \
7087 -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
71- -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} "
88+ -D LLDB_ENABLE_PYTHON=ON \
89+ -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON
7290
7391echo " --- ninja"
92+
7493# Targets are not escaped as they are passed as separate arguments.
7594ninja -C " ${BUILD_DIR} " -k 0 ${targets}
7695
77- runtimes=" ${3} "
7896runtime_targets=" ${4} "
7997
80- # Compiling runtimes with just-built Clang and running their tests
81- # as an additional testing for Clang.
98+ # Run runtimes tests.
99+ # We don't need to do a clean separate build of runtimes, because runtimes
100+ # will be built against just built clang, and because LIBCXX_TEST_PARAMS
101+ # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
102+ # propagates without a clean build. Other that those two variables, builds
103+ # are supposed to be the same.
82104if [[ " ${runtimes} " != " " ]]; then
83105 if [[ " ${runtime_targets} " == " " ]]; then
84106 echo " Runtimes to build are specified, but targets are not."
85107 exit 1
86108 fi
87109
88- echo " --- ninja install-clang"
89-
90- ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
91-
92- RUNTIMES_BUILD_DIR=" ${MONOREPO_ROOT} /build-runtimes"
93- INSTALL_DIR=" ${BUILD_DIR} /install"
94- mkdir -p ${RUNTIMES_BUILD_DIR}
95-
96110 echo " --- cmake runtimes C++26"
97111
98- rm -rf " ${RUNTIMES_BUILD_DIR} "
99- cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
100- -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
101- -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
102- -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
103- -D LIBCXX_CXX_ABI=libcxxabi \
104- -D CMAKE_BUILD_TYPE=RelWithDebInfo \
105- -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
112+ cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
106113 -D LIBCXX_TEST_PARAMS=" std=c++26" \
107- -D LIBCXXABI_TEST_PARAMS=" std=c++26" \
108- -D LLVM_LIT_ARGS=" ${lit_args} "
114+ -D LIBCXXABI_TEST_PARAMS=" std=c++26"
109115
110116 echo " --- ninja runtimes C++26"
111117
112- ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
118+ ninja -vC " ${BUILD_DIR } " ${runtime_targets}
113119
114120 echo " --- cmake runtimes clang modules"
115121
116- # We don't need to do a clean build of runtimes, because LIBCXX_TEST_PARAMS
117- # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
118- # propagates without a clean build. Other that those two variables, builds
119- # are supposed to be the same.
120-
121- cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
122- -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
123- -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
124- -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
125- -D LIBCXX_CXX_ABI=libcxxabi \
126- -D CMAKE_BUILD_TYPE=RelWithDebInfo \
127- -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
122+ cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
128123 -D LIBCXX_TEST_PARAMS=" enable_modules=clang" \
129- -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang" \
130- -D LLVM_LIT_ARGS=" ${lit_args} "
124+ -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang"
131125
132126 echo " --- ninja runtimes clang modules"
133127
134- ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
128+ ninja -vC " ${BUILD_DIR } " ${runtime_targets}
135129fi
0 commit comments