<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">This is a workaround and not a solution, but you should be able to add /manifest:no to your link flags (similar to
<a href="https://github.com/llvm/llvm-project/blob/3187a4f3f1d4d68a75a21154569db1232a62a57d/llvm/cmake/platforms/WinMsvc.cmake#L286-L287">
https://github.com/llvm/llvm-project/blob/3187a4f3f1d4d68a75a21154569db1232a62a57d/llvm/cmake/platforms/WinMsvc.cmake#L286-L287</a>) to prevent CMake from trying to invoke mt.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">cfe-dev <cfe-dev-bounces@lists.llvm.org> on behalf of cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Reply-To: </b>Adrian McCarthy <amccarth@google.com><br>
<b>Date: </b>Friday, August 20, 2021 at 4:35 PM<br>
<b>To: </b>cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Subject: </b>[cfe-dev] Cannot CMake self-hosted clang on Windows for lack of libxml2<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">I recently tried to build a self-hosted clang on Windows, but it fails when I use CMake to generate a Ninja file.<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">CMake finds my MSVC-built clang and tries to test it.  This invokes llvm-mt (the LLVM implementation of the manifest tool).  This tool depends on libxml2, which isn't typically installed on Windows.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">I'm told the Windows build shouldn't need to invoke llvm-mt, so this is probably due to a CMake change.  Unfortunately, I don't know how far back I have to go to find a working build so that I can bisect the breaking
 change.  It's been a long time since I've tried a self-hosted build.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Maybe somebody changed this intentionally, and we just need to update the documentation to include libxml2 on the (already very long) list of things Windows developers have to install in order to build llvm.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">If you have knowledge of this, let me know.  In the meantime, I'll attempt to bisect.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">See below for the gory details.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Adrian.<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:7.5pt;font-family:"Courier New"">cmake -GNinja -DPYTHON_HOME="C:\Program Files\Python38" -DLLDB_PYTHON_HOME="C:\Program Files\Python38" -DPYTHON_EXECUTABLE="C:\Program Files\Python38\bin\python.exe"
 -DPython3_ROOT_DIR="C:\Program Files\Python38" -DPython3_FIND_REGISTRY=LAST ..\..\llvm-project\llvm -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_PROJECTS="clang;lld;lldb" -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=D:/src/llvm/build/ninja/bin/clang-cl.exe
 -DCMAKE_CXX_COMPILER=D:/src/llvm/build/ninja/bin/clang-cl.exe</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">-- The C compiler identification is Clang 14.0.0 with MSVC-like command-line</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">-- The CXX compiler identification is Clang 14.0.0 with MSVC-like command-line</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">-- The ASM compiler identification is Clang</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">-- Found assembler: D:/src/llvm/build/ninja/bin/clang-cl.exe</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">-- Detecting C compiler ABI info</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">-- Detecting C compiler ABI info - failed</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">-- Check for working C compiler: D:/src/llvm/build/ninja/bin/clang-cl.exe</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">-- Check for working C compiler: D:/src/llvm/build/ninja/bin/clang-cl.exe - broken</span><br>
<span style="font-size:10.0pt;font-family:"Courier New"">CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:7.5pt;font-family:"Courier New"">  The C compiler</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:7.5pt;font-family:"Courier New""><br>
    "D:/src/llvm/build/ninja/bin/clang-cl.exe"<br>
<br>
  is not able to compile a simple test program.<br>
<br>
  It fails with the following output:<br>
<br>
    Change Dir: D:/src/llvm/build/selfhost/CMakeFiles/CMakeTmp<br>
<br>
    Run Build Command(s):C:/PROGRA~2/MICROS~1/2019/PROFES~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_62af5 && [1/2] Building C object CMakeFiles\cmTC_62af5.dir\testCCompiler.c.obj<br>
    [2/2] Linking C executable cmTC_62af5.exe<br>
    FAILED: cmTC_62af5.exe<br>
    cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_62af5.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe
 --mt=D:\src\llvm\build\ninja\bin\llvm-mt.exe --manifests  -- D:\src\llvm\build\ninja\bin\lld-link.exe /nologo CMakeFiles\cmTC_62af5.dir\testCCompiler.c.obj  /out:cmTC_62af5.exe /implib:cmTC_62af5.lib /pdb:cmTC_62af5.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL
 /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."<br>
    MT: command "D:\src\llvm\build\ninja\bin\llvm-mt.exe /nologo /manifest CMakeFiles\cmTC_62af5.dir/intermediate.manifest /out:CMakeFiles\cmTC_62af5.dir/embed.manifest /notify_update" failed (exit code 0x1) with the following output:<br>
    llvm-mt: error: no libxml2<br>
    llvm-mt: ignoring unsupported 'notify_update' option</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:7.5pt;font-family:"Courier New"">    ninja: build stopped: subcommand failed.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>