[cfe-dev] Cannot CMake self-hosted clang on Windows for lack of libxml2

Adrian McCarthy via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 20 16:34:34 PDT 2021

I recently tried to build a self-hosted clang on Windows, but it fails when
I use CMake to generate a Ninja file.

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.

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.

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.

If you have knowledge of this, let me know.  In the meantime, I'll attempt
to bisect.

See below for the gory details.


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

-- The C compiler identification is Clang 14.0.0 with MSVC-like command-line
-- The CXX compiler identification is Clang 14.0.0 with MSVC-like
-- The ASM compiler identification is Clang
-- Found assembler: D:/src/llvm/build/ninja/bin/clang-cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: D:/src/llvm/build/ninja/bin/clang-cl.exe
-- Check for working C compiler: D:/src/llvm/build/ninja/bin/clang-cl.exe -
CMake Error at C:/Program Files (x86)/Microsoft Visual
  The C compiler


  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/src/llvm/build/selfhost/CMakeFiles/CMakeTmp

    Run Build
cmTC_62af5 && [1/2] Building C object
    [2/2] Linking C executable cmTC_62af5.exe
    FAILED: cmTC_62af5.exe
    cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual
-E vs_link_exe --intdir=CMakeFiles\cmTC_62af5.dir
--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 ."
    MT: command "D:\src\llvm\build\ninja\bin\llvm-mt.exe /nologo /manifest
/out:CMakeFiles\cmTC_62af5.dir/embed.manifest /notify_update" failed (exit
code 0x1) with the following output:
    llvm-mt: error: no libxml2
    llvm-mt: ignoring unsupported 'notify_update' option
    ninja: build stopped: subcommand failed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210820/1f896579/attachment.html>

More information about the cfe-dev mailing list