Skip to content

Commit

Permalink
Fix codespaces build by bumping clang llvm (dotnet#105385)
Browse files Browse the repository at this point in the history
* Replace system clang.

* Unify dockerfiles.

* Update docs.

* Feedback: typo
  • Loading branch information
ilonatommy authored Jul 24, 2024
1 parent 34f125f commit d91d9a1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
11 changes: 9 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
ARG VARIANT="6.0-jammy"
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}

# Set up machine requirements to build the repo and the gh CLI
# Clang-16 up is required but Ubuntu 22.04 comes with clang-14 highest, so add clang-18 sources
RUN apt-get update \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
&& apt-get install software-properties-common -y \
&& add-apt-repository "deb http://apt.llvm.org/$(lsb_release -s -c)/ llvm-toolchain-$(lsb_release -s -c)-18 main" -y \
&& apt-get update \
&& apt-get install clang-18 -y

# Set up machine requirements to build the repo and the gh CLI
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
cmake \
llvm \
clang \
build-essential \
python3 \
curl \
Expand Down
11 changes: 9 additions & 2 deletions .devcontainer/wasm-multiThreaded/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
ARG VARIANT="6.0-jammy"
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}

# Set up machine requirements to build the repo and the gh CLI
# Clang-16 up is required but Ubuntu 22.04 comes with clang-14 highest, so add clang-18 sources
RUN apt-get update \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
&& apt-get install software-properties-common -y \
&& add-apt-repository "deb http://apt.llvm.org/$(lsb_release -s -c)/ llvm-toolchain-$(lsb_release -s -c)-18 main" -y \
&& apt-get update \
&& apt-get install clang-18 -y

# Set up machine requirements to build the repo and the gh CLI
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
cmake \
llvm \
clang \
build-essential \
python3 \
curl \
Expand Down
10 changes: 8 additions & 2 deletions .devcontainer/wasm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ ARG VARIANT="6.0-jammy"
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}

# Set up machine requirements to build the repo and the gh CLI
# Clang-16 up is required but Ubuntu 22.04 comes with clang-14 highest, so add clang-18 sources
RUN apt-get update \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
&& apt-get install software-properties-common -y \
&& add-apt-repository "deb http://apt.llvm.org/$(lsb_release -s -c)/ llvm-toolchain-$(lsb_release -s -c)-18 main" -y \
&& apt-get update \
&& apt-get install clang-18 -y

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
cmake \
llvm \
clang \
build-essential \
python3 \
curl \
Expand Down
3 changes: 2 additions & 1 deletion docs/workflow/requirements/linux-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Install the following packages for the toolchain:
* CMake 3.20 or newer
* llvm
* lld
* clang
* clang 16 or newer
* build-essential
* python-is-python3
* curl
Expand All @@ -59,6 +59,7 @@ sudo apt install -y cmake llvm lld clang build-essential \
```

**NOTE**: As of now, Ubuntu's `apt` only has until CMake version 3.16.3 if you're using Ubuntu 20.04 LTS (less in older Ubuntu versions), and version 3.18.4 in Debian 11 (less in older Debian versions). This is lower than the required 3.20, which in turn makes it incompatible with the repo. For this case, we can use the `snap` package manager or the _Kitware APT feed_ to get a new enough version of CMake.
**NOTE**: If you have Ubuntu 22.04 LTS and older and your `apt` does not have clang version 16, you can add `"deb http://apt.llvm.org/$(lsb_release -s -c)/ llvm-toolchain-$(lsb_release -s -c)-18 main"` repository to your `apt`. See how we do it for linux-based containers [here](./../../../.devcontainer/Dockerfile).

For snap:

Expand Down

0 comments on commit d91d9a1

Please sign in to comment.