mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 13:50:10 +01:00
Move to clang 21 as mininum version and use it in CI (#7779)
Clang 21 is now the latest version available in Ubuntu LTS, so we can move to it.
This commit is contained in:
@@ -23,7 +23,7 @@ runs:
|
|||||||
xcrun simctl delete all
|
xcrun simctl delete all
|
||||||
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
|
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
|
||||||
|
|
||||||
# Install and cache LLVM 19 from Homebrew. Some runners may have LLVM 19,
|
# Install and cache LLVM 21 from Homebrew. Some runners may have LLVM 21,
|
||||||
# but this is reliable (including with libc++), and gives us testing at the
|
# but this is reliable (including with libc++), and gives us testing at the
|
||||||
# minimum supported LLVM version.
|
# minimum supported LLVM version.
|
||||||
- name: Cache Homebrew
|
- name: Cache Homebrew
|
||||||
@@ -46,7 +46,7 @@ runs:
|
|||||||
}}
|
}}
|
||||||
# Note the key needs to include all the packages we're adding.
|
# Note the key needs to include all the packages we're adding.
|
||||||
key:
|
key:
|
||||||
Homebrew-Cache-${{ inputs.matrix_runner }}-${{ runner.arch }}-llvm@19
|
Homebrew-Cache-${{ inputs.matrix_runner }}-${{ runner.arch }}-llvm@21
|
||||||
|
|
||||||
- name: Install LLVM and Clang with Homebrew
|
- name: Install LLVM and Clang with Homebrew
|
||||||
if: steps.cache-homebrew-macos.outputs.cache-hit != 'true'
|
if: steps.cache-homebrew-macos.outputs.cache-hit != 'true'
|
||||||
@@ -60,11 +60,11 @@ runs:
|
|||||||
LEAVES=$(brew leaves | egrep -v '^(bazelisk|gh|git|git-lfs|gnu-tar|go@.*|jq|pipx|node@.*|openssl@.*|wget|yq|zlib)$')
|
LEAVES=$(brew leaves | egrep -v '^(bazelisk|gh|git|git-lfs|gnu-tar|go@.*|jq|pipx|node@.*|openssl@.*|wget|yq|zlib)$')
|
||||||
brew uninstall -f --ignore-dependencies $LEAVES
|
brew uninstall -f --ignore-dependencies $LEAVES
|
||||||
echo '*** Installing LLVM deps'
|
echo '*** Installing LLVM deps'
|
||||||
brew install --force-bottle --only-dependencies llvm@19
|
brew install --force-bottle --only-dependencies llvm@21
|
||||||
echo '*** Installing LLVM itself'
|
echo '*** Installing LLVM itself'
|
||||||
brew install --force-bottle --force --verbose llvm@19
|
brew install --force-bottle --force --verbose llvm@21
|
||||||
echo '*** brew info llvm@19'
|
echo '*** brew info llvm@21'
|
||||||
brew info llvm@19
|
brew info llvm@21
|
||||||
echo '*** brew autoremove'
|
echo '*** brew autoremove'
|
||||||
brew autoremove
|
brew autoremove
|
||||||
echo '*** brew info'
|
echo '*** brew info'
|
||||||
@@ -77,7 +77,7 @@ runs:
|
|||||||
- name: Setup LLVM and Clang
|
- name: Setup LLVM and Clang
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
LLVM_PATH="$(brew --prefix llvm@19)"
|
LLVM_PATH="$(brew --prefix llvm@21)"
|
||||||
echo "Using ${LLVM_PATH}"
|
echo "Using ${LLVM_PATH}"
|
||||||
echo "${LLVM_PATH}/bin" >> $GITHUB_PATH
|
echo "${LLVM_PATH}/bin" >> $GITHUB_PATH
|
||||||
echo '*** ls "${LLVM_PATH}"'
|
echo '*** ls "${LLVM_PATH}"'
|
||||||
|
|||||||
@@ -23,17 +23,13 @@ runs:
|
|||||||
large-packages: false
|
large-packages: false
|
||||||
|
|
||||||
# Select the LLVM release - by the cache key and the download.
|
# Select the LLVM release - by the cache key and the download.
|
||||||
#
|
|
||||||
# x86-64 uses the LLVM 19 monolithic package. That release only
|
|
||||||
# published a smaller community build for Linux AArch64, so AArch64 uses
|
|
||||||
# the official monolithic package, first available in LLVM 20.
|
|
||||||
- name: Select LLVM release
|
- name: Select LLVM release
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ runner.arch }}" == "ARM64" ]]; then
|
if [[ "${{ runner.arch }}" == "ARM64" ]]; then
|
||||||
echo "LLVM_RELEASE=20.1.8" >> "$GITHUB_ENV"
|
echo "LLVM_RELEASE=21.1.8" >> "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
echo "LLVM_RELEASE=19.1.7" >> "$GITHUB_ENV"
|
echo "LLVM_RELEASE=21.1.8" >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cache and install a recent version of LLVM. This uses the GitHub action
|
# Cache and install a recent version of LLVM. This uses the GitHub action
|
||||||
|
|||||||
Generated
+1
-1
@@ -307,7 +307,7 @@
|
|||||||
"moduleExtensions": {
|
"moduleExtensions": {
|
||||||
"//bazel/cc_toolchains:clang_configuration.bzl%clang_toolchain_extension": {
|
"//bazel/cc_toolchains:clang_configuration.bzl%clang_toolchain_extension": {
|
||||||
"general": {
|
"general": {
|
||||||
"bzlTransitiveDigest": "DyUCJOgQYb+hGTTTtitbFytne29L1JZ2UsbwLpdkMKM=",
|
"bzlTransitiveDigest": "IGxGFknaFQQo7RudzfwIOuxREEsnEXwlM9KuPiNQYBM=",
|
||||||
"usagesDigest": "lTxkeAFhR0iBEa3dg5hWvtd2HFCr5zCJx/fl27A+IKA=",
|
"usagesDigest": "lTxkeAFhR0iBEa3dg5hWvtd2HFCr5zCJx/fl27A+IKA=",
|
||||||
"recordedFileInputs": {},
|
"recordedFileInputs": {},
|
||||||
"recordedDirentsInputs": {},
|
"recordedDirentsInputs": {},
|
||||||
|
|||||||
@@ -188,9 +188,9 @@ def _configure_clang_toolchain_impl(repository_ctx):
|
|||||||
(clang, clang_version, clang_version_for_cache) = _detect_system_clang(
|
(clang, clang_version, clang_version_for_cache) = _detect_system_clang(
|
||||||
repository_ctx,
|
repository_ctx,
|
||||||
)
|
)
|
||||||
if clang_version and clang_version < 19:
|
if clang_version and clang_version < 21:
|
||||||
fail("Found clang {0}. ".format(clang_version) +
|
fail("Found clang {0}. ".format(clang_version) +
|
||||||
"Carbon requires clang >=19. See " +
|
"Carbon requires clang >=21. See " +
|
||||||
"https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md#old-llvm-versions")
|
"https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md#old-llvm-versions")
|
||||||
|
|
||||||
clang_cpp = clang.dirname.get_child("clang++")
|
clang_cpp = clang.dirname.get_child("clang++")
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ These commands should help set up a development environment on your machine.
|
|||||||
# Update apt.
|
# Update apt.
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
|
||||||
# Check that the `clang` version is at least 19, our minimum version. That needs
|
# Check that the `clang` version is at least 21, our minimum version. That needs
|
||||||
# the number of the `:` in the output to be over 19. For example, `1:19.0-1`.
|
# the number of the `:` in the output to be over 21. For example, `1:21.0-1`.
|
||||||
apt-cache show clang | grep 'Version:'
|
apt-cache show clang | grep 'Version:'
|
||||||
|
|
||||||
# Install tools. Use the same version as the Clang version you found above. Do
|
# Install tools. Use the same version as the Clang version you found above. Do
|
||||||
@@ -88,28 +88,28 @@ it to your `$PATH`, and aliasing `bazel` to it.
|
|||||||
|
|
||||||
#### Old `clang` versions
|
#### Old `clang` versions
|
||||||
|
|
||||||
If the version of `clang` is earlier than 19, you may still have version 19
|
If the version of `clang` is earlier than 21, you may still have version 21
|
||||||
available. You can use the following install instead:
|
available. You can use the following install instead:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Install explicitly versioned Clang tools.
|
# Install explicitly versioned Clang tools.
|
||||||
sudo apt install \
|
sudo apt install \
|
||||||
clang-19 \
|
clang-21 \
|
||||||
libc++-19-dev \
|
libc++-21-dev \
|
||||||
libc++abi-19-dev \
|
libc++abi-21-dev \
|
||||||
lld-19 \
|
lld-21 \
|
||||||
lldb-19
|
lldb-21
|
||||||
|
|
||||||
# In your Carbon checkout, tell Bazel where to find `clang`. You can also
|
# In your Carbon checkout, tell Bazel where to find `clang`. You can also
|
||||||
# export this path as the `CC` environment variable, or add it directly to
|
# export this path as the `CC` environment variable, or add it directly to
|
||||||
# your `PATH`.
|
# your `PATH`.
|
||||||
echo "build --repo_env=CC=$(readlink -f $(which clang-19))" >> user.bazelrc
|
echo "build --repo_env=CC=$(readlink -f $(which clang-21))" >> user.bazelrc
|
||||||
```
|
```
|
||||||
|
|
||||||
And if it's not available directly from the distribution, you can install Clang
|
And if it's not available directly from the distribution, you can install Clang
|
||||||
tools on Debian/Ubuntu from <https://apt.llvm.org>.
|
tools on Debian/Ubuntu from <https://apt.llvm.org>.
|
||||||
|
|
||||||
> NOTE: Most LLVM 19+ installs should build Carbon. If you're having issues, see
|
> NOTE: Most LLVM 21+ installs should build Carbon. If you're having issues, see
|
||||||
> [troubleshooting build issues](#troubleshooting-build-issues).
|
> [troubleshooting build issues](#troubleshooting-build-issues).
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
@@ -203,7 +203,7 @@ These tools are essential for work on Carbon.
|
|||||||
- [Bazelisk](https://docs.bazel.build/versions/master/install-bazelisk.html):
|
- [Bazelisk](https://docs.bazel.build/versions/master/install-bazelisk.html):
|
||||||
Downloads and runs the [configured Bazel version](/.bazelversion).
|
Downloads and runs the [configured Bazel version](/.bazelversion).
|
||||||
- [Clang](https://clang.llvm.org/) and [LLVM](https://llvm.org/)
|
- [Clang](https://clang.llvm.org/) and [LLVM](https://llvm.org/)
|
||||||
- NOTE: Most LLVM 19+ installs should build Carbon. If you're having
|
- NOTE: Most LLVM 21+ installs should build Carbon. If you're having
|
||||||
issues, see
|
issues, see
|
||||||
[troubleshooting build issues](#troubleshooting-build-issues).
|
[troubleshooting build issues](#troubleshooting-build-issues).
|
||||||
- [gh CLI](https://github.com/cli/cli): Helps with GitHub.
|
- [gh CLI](https://github.com/cli/cli): Helps with GitHub.
|
||||||
@@ -419,8 +419,8 @@ includes things such as changing LLVM versions, or installing libc++. Running
|
|||||||
|
|
||||||
Many build issues result from the particular options `clang` and `llvm` have
|
Many build issues result from the particular options `clang` and `llvm` have
|
||||||
been built with, particularly when it comes to system-installed versions. If you
|
been built with, particularly when it comes to system-installed versions. If you
|
||||||
run `clang --version`, you should see at least version 19. If you see an older
|
run `clang --version`, you should see at least version 21. If you see an older
|
||||||
version, please update, or use the special `clang-19` instructions above.
|
version, please update, or use the special `clang-21` instructions above.
|
||||||
|
|
||||||
System installs of macOS typically won't work, for example being an old LLVM
|
System installs of macOS typically won't work, for example being an old LLVM
|
||||||
version or missing llvm-ar; [setup commands](#setup-commands) includes LLVM from
|
version or missing llvm-ar; [setup commands](#setup-commands) includes LLVM from
|
||||||
@@ -442,7 +442,7 @@ providing the output of the following diagnostic commands:
|
|||||||
```shell
|
```shell
|
||||||
echo $CC
|
echo $CC
|
||||||
which clang
|
which clang
|
||||||
which clang-19
|
which clang-21
|
||||||
clang --version
|
clang --version
|
||||||
grep llvm_bindir $(bazel info workspace)/bazel-execroot/external/+clang_toolchain_extension+bazel_cc_toolchain/clang_detected_variables.bzl
|
grep llvm_bindir $(bazel info workspace)/bazel-execroot/external/+clang_toolchain_extension+bazel_cc_toolchain/clang_detected_variables.bzl
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user