Issue 134237
Summary CMake prefers llvm-mt even when compiled without libxml2
Labels platform:windows, llvm-mt
Assignees
Reporter Meinersbur
    Since CMake 3.31 (commit https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9847) LLVM's llvm-mt.exe is prefered over Microsoft's mt.exe when compiling with clang-cl. When LLVM is not compiled with libxml2, the build fails with:
```
 Run Build Command(s): C:/ProgramData/chocolatey/bin/ninja.exe -v cmTC_bdbfc
 0.049 [1/1/1] C:\\buildbot\\flang-x86_64-windows\\build\\bin\\clang-cl.exe --target=x86_64-pc-windows-msvc  /nologo   /DWIN32 /D_WINDOWS  /Ob0 /Od /RTC1 -MDd -Zi /showIncludes /FoCMakeFiles\\cmTC_bdbfc.dir\\CMakeCCompilerABI.c.obj /FdCMakeFiles\\cmTC_bdbfc.dir\\ -c -- "C:\\Program Files\\CMake\\share\\cmake-3.31\\Modules\\CMakeCCompilerABI.c"
 0.247 [0/1/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "C:\\Program Files\\CMake\\bin\\cmake.exe" -E vs_link_exe --msvc-ver=1943 --intdir=CMakeFiles\\cmTC_bdbfc.dir --rc=C:\\buildbot\\flang-x86_64-windows\\build\\.\\bin\\llvm-rc.exe --mt=C:\\buildbot\\flang-x86_64-windows\\build\\bin\\llvm-mt.exe --manifests  -- C:\\PROGRA~1\\MICROS~2\\2022\\COMMUN~1\\VC\\Tools\\MSVC\\1443~1.348\\bin\\Hostx64\\x64\\link.exe /nologo CMakeFiles\\cmTC_bdbfc.dir\\CMakeCCompilerABI.c.obj /out:cmTC_bdbfc.exe /implib:cmTC_bdbfc.lib /pdb:cmTC_bdbfc.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console   && cd ."
 FAILED: cmTC_bdbfc.exe 
        C:\\Windows\\system32\\cmd.exe /C "cd . && "C:\\Program Files\\CMake\\bin\\cmake.exe" -E vs_link_exe --msvc-ver=1943 --intdir=CMakeFiles\\cmTC_bdbfc.dir --rc=C:\\buildbot\\flang-x86_64-windows\\build\\.\\bin\\llvm-rc.exe --mt=C:\\buildbot\\flang-x86_64-windows\\build\\bin\\llvm-mt.exe --manifests  -- C:\\PROGRA~1\\MICROS~2\\2022\\COMMUN~1\\VC\\Tools\\MSVC\\1443~1.348\\bin\\Hostx64\\x64\\link.exe /nologo CMakeFiles\\cmTC_bdbfc.dir\\CMakeCCompilerABI.c.obj /out:cmTC_bdbfc.exe /implib:cmTC_bdbfc.lib /pdb:cmTC_bdbfc.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console   && cd ."
        MT: command "C:\\buildbot\\flang-x86_64-windows\\build\\bin\\llvm-mt.exe /nologo /manifest CMakeFiles\\cmTC_bdbfc.dir/intermediate.manifest /out:CMakeFiles\\cmTC_bdbfc.dir/embed.manifest /notify_update" failed (exit code 0x1) with the following output:
        llvm-mt: error: no libxml2\x0d
        ninja: build stopped: subcommand failed.
```

When building a bootstapping runtimes build (e.g. `LLVM_ENABLE_RUNTIMES=flang-rt`) what happens depends whether `llvm-mt.exe` has been built before `ninja runtimes` or not. If it was, the runtimes build fails with:

```
901.041 [16/12/6860] Performing configure step for 'runtimes'
Not searching for unused variables given on the command line.
loading initial cache file C:/buildbot/flang-x86_64-windows/build/projects/runtimes/tmp/runtimes-cache-Release.cmake
-- Performing bootstrapping runtimes build.
CMake Deprecation Warning at C:/buildbot/flang-x86_64-windows/llvm-project/cmake/Modules/CMakePolicy.cmake:6 (cmake_policy):
  The OLD behavior for policy CMP0116 will be removed from a future version
  of CMake.
  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:18 (include)
-- The C compiler identification is Clang 21.0.0 with MSVC-like command-line
-- The CXX compiler identification is Clang 21.0.0 with MSVC-like command-line
-- The ASM compiler identification is Clang with MSVC-like command-line
-- Found assembler: C:/buildbot/flang-x86_64-windows/build/bin/clang-cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
[...]
```
With ABI info detection failed, some CMake features are not available, such as `target_compile_features`.

Observed with the [flang-x86_64-windows](https://lab.llvm.org/staging/#/builders/36) builder which failes irregularly because of this.



Related:
 * https://discourse.llvm.org/t/cannot-cmake-self-hosted-clang-on-windows-for-lack-of-libxml2/58793/8
 * https://github.com/llvm/llvm-project/issues/55817
 * https://gitlab.kitware.com/cmake/cmake/-/commit/73d0d4e4b5dd937dcc913a94a6ebac3085a01896
 * https://gitlab.kitware.com/cmake/cmake/-/issues/26319
 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to