Conversation
…changes CMake detects the compiler only on a build directory's first configure, so an existing build directory keeps using the old compiler when a different CMAKE_TOOLCHAIN_FILE is passed. The WASI SDK and emscripten live in versioned tool cache directories, so every SDK bump left incremental local builds compiling and linking with the previous SDK. When the existing CMakeCache.txt records a CMAKE_TOOLCHAIN_FILE different from the requested one, configure with --fresh. Applies to eng/native/gen-buildsys.sh and gen-buildsys.cmd (CoreCLR, native libraries, corehost) and to the Mono configure steps in mono.proj, wasi.proj and browser.proj. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
…nges Instead of comparing CMAKE_TOOLCHAIN_FILE against CMakeCache.txt (which needed per-SDK knowledge of the toolchain emcmake injects, plus path normalization), gen-buildsys.sh/.cmd now record the inputs that select the compiler in <build dir>/cmake_compiler_inputs.txt after a successful configure: the CMAKE_TOOLCHAIN_FILE environment variable, CC, CXX, every -DCMAKE_TOOLCHAIN_FILE argument, the full path of the cmake command and any wrapper such as emcmake, and on Windows VCToolsInstallDir. CMake is run with --fresh when an existing build directory's record is missing or differs. This covers WASI SDK and emsdk bumps as well as host compiler changes such as a new clang-N or CLR_CC. On Windows, emcmake is now invoked with `call` so control returns to the script when the launcher is a batch file. Revert the Mono configure changes (mono.proj, wasi.proj, browser.proj). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
akoeplinger
reviewed
Oct 1, 2026
Log a single message when the recorded compiler inputs are missing or differ, without printing a diff. In gen-buildsys.sh, keep the cmake invocation last (writing the record with `&&`) and restore the comment about exit code propagation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…path /usr/bin/clang on macOS is a shim, so an Xcode update or a DEVELOPER_DIR switch replaces the compiler without changing CC. Record the first line of `$CC --version` too. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
steveisok
approved these changes
Oct 2, 2026
Member
Is keeping the object files the desired behavior? I would expect that you want to wipe all object files when the compiler changes. |
jkotas
reviewed
Oct 2, 2026
|
|
||
| set __ExtraCmakeParams="-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLR_CMAKE_HOST_ARCH=%__Arch%" %__ExtraCmakeParams% | ||
|
|
||
| rem CMake detects the compiler only on a build directory's first configure. Later configures keep the |
Member
There was a problem hiding this comment.
FWIW, cmake is adding the first-class way to solve this problem: https://cmake.org/cmake/help/git-stage/envvar/CMAKE_SYSTEM_ENVIRONMENT_ACTION.html . Once we can depend on cmake 4.5 for day-to-day development, this open coded workaround can be simplified a lot.
This branch has not been deployed
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.
CMake detects the compiler only on a build directory's first configure, so later changes to the toolchain file,
CC/CXXoremcmakeare ignored. Since the WASI SDK and emsdk moved to versioned tool cache directories, every SDK bump leaves existing local build directories using the old compiler. After #134992 that caused link errors likeundefined symbol: __wasilibc_descriptor_deallocate. CI configures fresh and is unaffected.gen-buildsys.sh/.cmdnow record the inputs that select the compiler in<build dir>/cmake_compiler_inputs.txt: the toolchain file (environment variable and-DCMAKE_TOOLCHAIN_FILEarguments),CC,CXX, the first line of$CC --version(catches an Xcode update or package upgrade behind the same path), the resolved cmake command including wrappers likeemcmake, and on WindowsVCToolsInstallDir. If a build directory's record is missing or differs, CMake runs with--fresh. That keeps object files, so ninja only rebuilds what changed. Existing build directories reconfigure once, the first time they're built with this change.Validated locally on macOS. WASI SDK 33.0 → 34.0 (native libraries and CoreCLR), a
CLR_CChost compiler switch, an Xcode → Command Line Tools switch, and an emsdk version change all reconfigured with the new compiler, and unchanged builds stayed incremental.gen-buildsys.cmdwasn't run (no Windows host).Note
This PR description was generated with GitHub Copilot.