Skip to content

Commit c33049a

Browse files
committed
Address review comments: make CC and CXX mandatory
1 parent e300dfe commit c33049a

File tree

5 files changed

+98
-71
lines changed

5 files changed

+98
-71
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ jobs:
223223
source .venv/bin/activate
224224
python -m pip install psutil
225225
bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
226+
env:
227+
CC: clang
228+
CXX: clang++
226229
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
227230
if: always() # Upload artifacts even if the build or test suite fails
228231
with:
@@ -241,16 +244,16 @@ jobs:
241244
fail-fast: false
242245
matrix:
243246
include:
244-
- { config: clang-cl-dll, mingw: false }
245-
- { config: clang-cl-static, mingw: false }
246-
- { config: clang-cl-no-vcruntime, mingw: false }
247-
- { config: clang-cl-debug, mingw: false }
248-
- { config: clang-cl-static-crt, mingw: false }
249-
- { config: mingw-dll, mingw: true }
250-
- { config: mingw-static, mingw: true }
251-
- { config: mingw-dll-i686, mingw: true }
252-
- { config: mingw-incomplete-sysroot, mingw: true }
253-
- { config: mingw-static, mingw: true, runner: windows-11-arm }
247+
- { config: clang-cl-dll, mingw: false, cc: clang-cl, cxx: clang-cl }
248+
- { config: clang-cl-static, mingw: false, cc: clang-cl, cxx: clang-cl }
249+
- { config: clang-cl-no-vcruntime, mingw: false, cc: clang-cl, cxx: clang-cl }
250+
- { config: clang-cl-debug, mingw: false, cc: clang-cl, cxx: clang-cl }
251+
- { config: clang-cl-static-crt, mingw: false, cc: clang-cl, cxx: clang-cl }
252+
- { config: mingw-dll, mingw: true, cc: clang-cl, cxx: clang-cl }
253+
- { config: mingw-dll, mingw: true, cc: i686-w64-mingw32-clang, cxx: i686-w64-mingw32-clang++ }
254+
- { config: mingw-static, mingw: true, cc: clang-cl, cxx: clang-cl }
255+
- { config: mingw-incomplete-sysroot, mingw: true, cc: clang-cl, cxx: clang-cl }
256+
- { config: mingw-static, mingw: true, cc: clang-cl, cxx: clang-cl, runner: windows-11-arm }
254257
runs-on: ${{ matrix.runner != '' && matrix.runner || 'windows-2022' }}
255258
steps:
256259
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -286,5 +289,7 @@ jobs:
286289
run: |
287290
echo "c:\Program Files\LLVM\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
288291
- name: Build and test
289-
run: |
290-
bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
292+
run: bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
293+
env:
294+
CC: ${{ matrix.cc }}
295+
CXX: ${{ matrix.cxx }}

.github/workflows/libcxx-check-generated-files.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ jobs:
2222

2323
- name: Check generated files
2424
run: libcxx/utils/ci/run-buildbot check-generated-output
25+
env:
26+
CC: clang-22
27+
CXX: clang++-22

libcxx/docs/AddingNewCIJobs.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ An example of a job definition is:
2828
2929
- label: "C++11"
3030
command: "libcxx/utils/ci/run-buildbot generic-cxx11"
31+
env:
32+
CC: clang
33+
CXX: clang++
3134
artifact_paths:
3235
- "**/test-results.xml"
3336
agents:

libcxx/utils/ci/buildkite-pipeline.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,55 +37,79 @@ steps:
3737
steps:
3838
- label: AArch64
3939
command: libcxx/utils/ci/run-buildbot aarch64
40+
env:
41+
CC: clang
42+
CXX: clang++
4043
agents:
4144
queue: libcxx-builders-linaro-arm
4245
arch: aarch64
4346
<<: *common
4447

4548
- label: AArch64 -fno-exceptions
4649
command: libcxx/utils/ci/run-buildbot aarch64-no-exceptions
50+
env:
51+
CC: clang
52+
CXX: clang++
4753
agents:
4854
queue: libcxx-builders-linaro-arm
4955
arch: aarch64
5056
<<: *common
5157

5258
- label: Armv8
5359
command: libcxx/utils/ci/run-buildbot armv8
60+
env:
61+
CC: clang
62+
CXX: clang++
5463
agents:
5564
queue: libcxx-builders-linaro-arm
5665
arch: armv8l
5766
<<: *common
5867

5968
- label: Armv8 -fno-exceptions
6069
command: libcxx/utils/ci/run-buildbot armv8-no-exceptions
70+
env:
71+
CC: clang
72+
CXX: clang++
6173
agents:
6274
queue: libcxx-builders-linaro-arm
6375
arch: armv8l
6476
<<: *common
6577

6678
- label: Armv7
6779
command: libcxx/utils/ci/run-buildbot armv7
80+
env:
81+
CC: clang
82+
CXX: clang++
6883
agents:
6984
queue: libcxx-builders-linaro-arm
7085
arch: armv8l
7186
<<: *common
7287

7388
- label: Armv7 -fno-exceptions
7489
command: libcxx/utils/ci/run-buildbot armv7-no-exceptions
90+
env:
91+
CC: clang
92+
CXX: clang++
7593
agents:
7694
queue: libcxx-builders-linaro-arm
7795
arch: armv8l
7896
<<: *common
7997

8098
- label: Armv7-M picolibc
8199
command: libcxx/utils/ci/run-buildbot armv7m-picolibc
100+
env:
101+
CC: clang
102+
CXX: clang++
82103
agents:
83104
queue: libcxx-builders-linaro-arm
84105
arch: aarch64
85106
<<: *common
86107

87108
- label: Armv7-M picolibc -fno-exceptions
88109
command: libcxx/utils/ci/run-buildbot armv7m-picolibc-no-exceptions
110+
env:
111+
CC: clang
112+
CXX: clang++
89113
agents:
90114
queue: libcxx-builders-linaro-arm
91115
arch: aarch64
@@ -131,13 +155,19 @@ steps:
131155
steps:
132156
- label: Android 5.0, x86 NDK
133157
command: libcxx/utils/ci/run-buildbot android-ndk-21-def-x86
158+
env:
159+
CC: /opt/android/clang/clang-current/bin/clang
160+
CXX: /opt/android/clang/clang-current/bin/clang++
134161
agents:
135162
queue: libcxx-builders
136163
os: android
137164
<<: *common
138165

139166
- label: Android 13, x86_64 NDK
140167
command: libcxx/utils/ci/run-buildbot android-ndk-33-goog-x86_64
168+
env:
169+
CC: /opt/android/clang/clang-current/bin/clang
170+
CXX: /opt/android/clang/clang-current/bin/clang++
141171
agents:
142172
queue: libcxx-builders
143173
os: android

libcxx/utils/ci/run-buildbot

Lines changed: 45 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,44 @@ ${PROGNAME} [options] <BUILDER>
3030
3131
Environment variables
3232
CC The C compiler to use, this value is used by CMake. This
33-
variable is optional.
33+
variable is mandatory.
3434
3535
CXX The C++ compiler to use, this value is used by CMake. This
36-
variable is optional.
36+
variable is mandatory.
3737
38-
CMAKE The CMake binary to use. This variable is optional.
39-
40-
CLANG_FORMAT The clang-format binary to use when generating the format
41-
ignore list.
38+
CMAKE The CMake binary to use. This variable is optional, it defaults
39+
to whatever 'cmake' binary is in the PATH.
4240
41+
CCACHE The ccache binary to use. This variable is optional and is only
42+
used by the bootstrapping build.
4343
EOF
4444
}
4545

46+
function step() {
47+
endstep
48+
set +x
49+
if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
50+
echo "::group::$1"
51+
export IN_GROUP=1
52+
else
53+
echo "--- $1"
54+
fi
55+
set -x
56+
}
57+
58+
function endstep() {
59+
set +x
60+
if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
61+
echo "::endgroup::"
62+
unset IN_GROUP
63+
fi
64+
set -x
65+
}
66+
67+
function error() {
68+
echo "::error::$1"
69+
}
70+
4671
if [[ $# == 0 ]]; then
4772
usage
4873
exit 0
@@ -88,6 +113,16 @@ else
88113
NINJA="ninja"
89114
fi
90115

116+
if [ -z "${CC}" ]; then
117+
error "Environment variable CC must be defined"
118+
exit 1
119+
fi
120+
121+
if [ -z "${CXX}" ]; then
122+
error "Environment variable CXX must be defined"
123+
exit 1
124+
fi
125+
91126
if [ -z "${CMAKE}" ]; then
92127
if xcrun --find cmake &>/dev/null; then
93128
CMAKE="$(xcrun --find cmake)"
@@ -96,39 +131,6 @@ if [ -z "${CMAKE}" ]; then
96131
fi
97132
fi
98133

99-
if [ -z "${CC}" ]; then
100-
CC=cc
101-
fi
102-
103-
if [ -z "${CXX}" ]; then
104-
CXX=c++
105-
fi
106-
107-
function step() {
108-
endstep
109-
set +x
110-
if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
111-
echo "::group::$1"
112-
export IN_GROUP=1
113-
else
114-
echo "--- $1"
115-
fi
116-
set -x
117-
}
118-
119-
function endstep() {
120-
set +x
121-
if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
122-
echo "::endgroup::"
123-
unset IN_GROUP
124-
fi
125-
set -x
126-
}
127-
128-
function error() {
129-
echo "::error::$1"
130-
}
131-
132134
# Print the version of a few tools to aid diagnostics in some cases
133135
step "Diagnose tools in use"
134136
${CMAKE} --version
@@ -167,11 +169,7 @@ function generate-cmake() {
167169
}
168170

169171
function generate-cmake-libcxx-win() {
170-
generate-cmake-base \
171-
-DLLVM_ENABLE_RUNTIMES="libcxx" \
172-
-DCMAKE_C_COMPILER=clang-cl \
173-
-DCMAKE_CXX_COMPILER=clang-cl \
174-
"${@}"
172+
generate-cmake-base -DLLVM_ENABLE_RUNTIMES="libcxx" "${@}"
175173
}
176174

177175
function generate-cmake-android() {
@@ -391,16 +389,16 @@ generic-ubsan)
391389
bootstrapping-build)
392390
clean
393391

394-
if which ccache; then
395-
CCACHE="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
392+
if [ ! -z ${CCACHE+x} ]; then
393+
COMPILER_LAUNCHER="-DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE}"
396394
fi
397395

398396
step "Generating CMake"
399397
${CMAKE} \
400398
-S "${MONOREPO_ROOT}/llvm" \
401399
-B "${BUILD_DIR}" \
402400
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
403-
${CCACHE} \
401+
${COMPILER_LAUNCHER} \
404402
-DCMAKE_BUILD_TYPE=Release \
405403
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
406404
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
@@ -727,14 +725,6 @@ mingw-static)
727725
-DLIBUNWIND_ENABLE_SHARED=OFF
728726
check-runtimes
729727
;;
730-
mingw-dll-i686)
731-
clean
732-
generate-cmake \
733-
-DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
734-
-DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \
735-
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
736-
check-runtimes
737-
;;
738728
mingw-incomplete-sysroot)
739729
# When bringing up a new cross compiler from scratch, we build
740730
# libunwind/libcxx in a setup where the toolchain is incomplete and
@@ -779,10 +769,6 @@ android-ndk-*)
779769
fi
780770
ARCH=$(arch_of_emu_img ${ANDROID_EMU_IMG})
781771

782-
# Use the Android compiler by default.
783-
export CC=${CC:-/opt/android/clang/clang-current/bin/clang}
784-
export CXX=${CXX:-/opt/android/clang/clang-current/bin/clang++}
785-
786772
# The NDK libc++_shared.so is always built against the oldest supported API
787773
# level. When tests are run against a device with a newer API level, test
788774
# programs can be built for any supported API level, but building for the

0 commit comments

Comments
 (0)