Skip to content

Install clang in codespace for NativeAOT builds#55291

Merged
lbussell merged 3 commits into
mainfrom
marcpopmsft-fix-codespace-clang-for-aot
Jul 17, 2026
Merged

Install clang in codespace for NativeAOT builds#55291
lbussell merged 3 commits into
mainfrom
marcpopmsft-fix-codespace-clang-for-aot

Conversation

@marcpopMSFT

Copy link
Copy Markdown
Member

Summary

The devcontainer base Debian image (mcr.microsoft.com/devcontainers/base:debian) doesn't include clang, which is required by the dotnet-aot NativeAOT component build. Without it, the build fails with:

EXEC : error No compatible version of clang was found within the range of 8 to 23.
Please upgrade your toolchain or specify the compiler explicitly using CLR_CC and CLR_CXX environment variables.

Changes

Adds the LLVM apt repository and installs clang-18 in the devcontainer post-creation script, before restore/build runs. The script sources /etc/os-release for 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.

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>
Copilot AI review requested due to automatic review settings July 15, 2026 00:08
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-18 before running repo restore/build steps.

Comment thread .devcontainer/scripts/post-creation.sh Outdated
Comment thread .devcontainer/scripts/post-creation.sh Outdated
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>
Comment thread .devcontainer/scripts/post-creation.sh Outdated
Co-authored-by: Logan Bussell <loganbussell@microsoft.com>
@lbussell

lbussell commented Jul 17, 2026

Copy link
Copy Markdown
Member

No reason not to merge this now since it was broken before, we can optimize with gcc later if the issue is fixed in arcade.

@lbussell
lbussell merged commit a583db5 into main Jul 17, 2026
11 checks passed
@lbussell
lbussell deleted the marcpopmsft-fix-codespace-clang-for-aot branch July 17, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants