@@ -18,7 +18,6 @@ set -o pipefail
18
18
19
19
MONOREPO_ROOT=" ${MONOREPO_ROOT:= " $( git rev-parse --show-toplevel) " } "
20
20
BUILD_DIR=" ${BUILD_DIR:= ${MONOREPO_ROOT} / build} "
21
- INSTALL_DIR=" ${BUILD_DIR} /install"
22
21
rm -rf " ${BUILD_DIR} "
23
22
24
23
ccache --zero-stats
@@ -28,10 +27,14 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
28
27
ccache --clear
29
28
fi
30
29
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
+
31
35
function at-exit {
32
36
retcode=$?
33
37
34
- mkdir -p artifacts
35
38
ccache --print-stats > artifacts/ccache_stats.txt
36
39
cp " ${BUILD_DIR} " /.ninja_log artifacts/.ninja_log
37
40
@@ -50,17 +53,28 @@ trap at-exit EXIT
50
53
51
54
projects=" ${1} "
52
55
targets=" ${2} "
56
+ runtimes=" ${3} "
53
57
54
58
lit_args=" -v --xunit-xml-output ${BUILD_DIR} /test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
55
59
56
60
echo " --- cmake"
61
+
57
62
export PIP_BREAK_SYSTEM_PACKAGES=1
58
63
pip install -q -r " ${MONOREPO_ROOT} " /mlir/python/requirements.txt
59
64
pip install -q -r " ${MONOREPO_ROOT} " /lldb/test/requirements.txt
60
65
pip 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.
61
73
cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
62
74
-D LLVM_ENABLE_PROJECTS=" ${projects} " \
75
+ -D LLVM_ENABLE_RUNTIMES=" libcxx;libcxxabi;libunwind" \
63
76
-G Ninja \
77
+ -D CMAKE_PREFIX_PATH=" ${HOME} /.local" \
64
78
-D CMAKE_BUILD_TYPE=Release \
65
79
-D LLVM_ENABLE_ASSERTIONS=ON \
66
80
-D LLVM_BUILD_EXAMPLES=ON \
@@ -69,69 +83,47 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
69
83
-D LLVM_ENABLE_LLD=ON \
70
84
-D CMAKE_CXX_FLAGS=-gmlt \
71
85
-D LLVM_CCACHE_BUILD=ON \
86
+ -D LIBCXX_CXX_ABI=libcxxabi \
72
87
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
73
- -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} "
88
+ -D LLDB_ENABLE_PYTHON=ON \
89
+ -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON
74
90
75
91
echo " --- ninja"
92
+
76
93
# Targets are not escaped as they are passed as separate arguments.
77
94
ninja -C " ${BUILD_DIR} " -k 0 ${targets}
78
95
79
- runtimes=" ${3} "
80
96
runtime_targets=" ${4} "
81
97
82
- # Compiling runtimes with just-built Clang and running their tests
83
- # 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.
84
104
if [[ " ${runtimes} " != " " ]]; then
85
105
if [[ " ${runtime_targets} " == " " ]]; then
86
106
echo " Runtimes to build are specified, but targets are not."
87
107
exit 1
88
108
fi
89
109
90
- echo " --- ninja install-clang"
91
-
92
- ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
93
-
94
- RUNTIMES_BUILD_DIR=" ${MONOREPO_ROOT} /build-runtimes"
95
- INSTALL_DIR=" ${BUILD_DIR} /install"
96
- mkdir -p ${RUNTIMES_BUILD_DIR}
97
-
98
110
echo " --- cmake runtimes C++26"
99
111
100
- rm -rf " ${RUNTIMES_BUILD_DIR} "
101
- cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
102
- -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
103
- -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
104
- -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
105
- -D LIBCXX_CXX_ABI=libcxxabi \
106
- -D CMAKE_BUILD_TYPE=RelWithDebInfo \
107
- -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
112
+ cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
108
113
-D LIBCXX_TEST_PARAMS=" std=c++26" \
109
- -D LIBCXXABI_TEST_PARAMS=" std=c++26" \
110
- -D LLVM_LIT_ARGS=" ${lit_args} "
114
+ -D LIBCXXABI_TEST_PARAMS=" std=c++26"
111
115
112
116
echo " --- ninja runtimes C++26"
113
117
114
- ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
118
+ ninja -vC " ${BUILD_DIR } " ${runtime_targets}
115
119
116
120
echo " --- cmake runtimes clang modules"
117
121
118
- # We don't need to do a clean build of runtimes, because LIBCXX_TEST_PARAMS
119
- # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
120
- # propagates without a clean build. Other that those two variables, builds
121
- # are supposed to be the same.
122
-
123
- cmake -S " ${MONOREPO_ROOT} /runtimes" -B " ${RUNTIMES_BUILD_DIR} " -GNinja \
124
- -D CMAKE_C_COMPILER=" ${INSTALL_DIR} /bin/clang" \
125
- -D CMAKE_CXX_COMPILER=" ${INSTALL_DIR} /bin/clang++" \
126
- -D LLVM_ENABLE_RUNTIMES=" ${runtimes} " \
127
- -D LIBCXX_CXX_ABI=libcxxabi \
128
- -D CMAKE_BUILD_TYPE=RelWithDebInfo \
129
- -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
122
+ cmake -S " ${MONOREPO_ROOT} " /llvm -B " ${BUILD_DIR} " \
130
123
-D LIBCXX_TEST_PARAMS=" enable_modules=clang" \
131
- -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang" \
132
- -D LLVM_LIT_ARGS=" ${lit_args} "
124
+ -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang"
133
125
134
126
echo " --- ninja runtimes clang modules"
135
127
136
- ninja -vC " ${RUNTIMES_BUILD_DIR } " ${runtime_targets}
128
+ ninja -vC " ${BUILD_DIR } " ${runtime_targets}
137
129
fi
0 commit comments