Install clang in codespace for NativeAOT builds#55291
Open
marcpopMSFT wants to merge 2 commits into
Open
Conversation
The devcontainer base Debian image doesn't ship clang, which is required by the dotnet-aot NativeAOT component build. Add the LLVM apt repository and install clang-18 in the post-creation script. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds LLVM/clang tooling to the Codespaces devcontainer so NativeAOT (dotnet-aot) builds can succeed on the base Debian image.
Changes:
- Adds the LLVM apt repository during devcontainer post-create.
- Installs
clang-18before running repo restore/build steps.
Comment on lines
+5
to
+8
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null | ||
| . /etc/os-release | ||
| echo "deb http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list | ||
| sudo apt-get update && sudo apt-get install -y clang-18 |
lbussell
requested changes
Jul 15, 2026
Comment on lines
+3
to
+8
| # Install clang (required for NativeAOT/dotnet-aot builds) | ||
| # The base Debian image doesn't include LLVM packages, so add the LLVM apt repository | ||
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null | ||
| . /etc/os-release | ||
| echo "deb http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list | ||
| sudo apt-get update && sudo apt-get install -y clang-18 |
Member
There was a problem hiding this comment.
Don't do this. Just pick a different base image. Switch to Ubuntu Noble or Resolute as the devcontainer base image instead of Debian.
Also, you don't need clang. All you need is gcc and zlib. See https://github.com/dotnet/dotnet-docker/blob/cbbef15bee70061b529b71a91f072dbe36fa3ddb/src/sdk/11.0/resolute-aot/amd64/Dockerfile#L6-L7
Per review feedback, switch the base image from Debian to Ubuntu and install only gcc + zlib1g-dev (not clang) for NativeAOT builds, matching the dotnet-docker AOT SDK image approach. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lbussell
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The devcontainer base Debian image (
mcr.microsoft.com/devcontainers/base:debian) doesn't include clang, which is required by thedotnet-aotNativeAOT component build. Without it, the build fails with:Changes
Adds the LLVM apt repository and installs
clang-18in the devcontainer post-creation script, before restore/build runs. The script sources/etc/os-releasefor the Debian codename so it adapts automatically if the base image version changes.Testing
Verified manually on a codespace that the install succeeds and the AOT build completes.