<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56271>56271</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Building LLVM on Windows using Clang and Ninja fails
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          lexika979
      </td>
    </tr>
</table>

<pre>
    Hello, i am trying to build LLVM on Windows (11) using Clang and Ninja.
I followed the documentation and the readme on the GitHub repo, and used the following commands:

```
git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git

cd llvm-project

cmake -S llvm -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release

cmake --build build
```

Both Ninja and Clang are the latest stable release.
Since the log itself is incredibly long, here are the parts i think are relevant:

```
[4/363] Linking CXX shared library bin\LTO.dll
FAILED: bin/LTO.dll lib/LTO.lib
cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -fuse-ld=lld-link -nostartfiles -nostdlib -Werror=date-time -Werror=unguarded-availability-new -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -ffunction-sections -fdata-sections -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt  -Wl,--gc-sections C:/Users/lexika/Desktop/llvm/llvm-project/build/tools/lto/LTO.def -shared -o bin\LTO.dll  -Xlinker /MANIFEST:EMBED -Xlinker /implib:lib\LTO.lib -Xlinker /pdb:bin\LTO.pdb -Xlinker /version:0.0 @CMakeFiles\LTO.rsp  && cd ."
lld-link: warning: ignoring unknown argument '--gc-sections'
lld-link: error: C:/Users/lexika/Desktop/llvm/llvm-project/build/tools/lto/LTO.def: unknown file type
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

ninja: build stopped: subcommand failed.
```

If i should post the full log (or any other info) just tell me, i'd attach it to this issue if someone wants it.

(Side note: Building with MSVC works)

Any help is appreciated :)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1Vktv2zgQ_jX2haBhy05sH3zwMw3WaYsmbbOngBYpmw1FaknKTvbX7zeU0sTdoMAeFhBEkTOc9zejnZPPsw_KGNfJlkwzUbLon7Xds-jYrtZGsu322w1zln3XVrpTYJ1sMhh0simrA_EtjcBbWMk-avtD9Dr9Vac_v2aFg9CTkiweFJMur0tlo4gakoiZTr0SslQkm3ZXOn6odziski3EVIf2fiOM1OWuLEEKneG80dS-L_vtk7Z7HVlunFWM89zZQtNFr3qiji73pugMV4UwQbFDjFWSlW3w4Nqh3vWgAxtjji8Lr7z7ofLYA8Nbrblkb8lnpFI8QvttYmB80QaTXyF-WYoUVsZXy5v5H-uHxdfr7erh7s_Pa1j2RRklgnpHGm-EpPe7fjfvhYuHJhspim2GvEqhNCKqEFmIYmcoBUlXm7VbbfOWy-2ZjkGZgunAcOyV1DvzDILdU3oOCvJeZFbCR3DhW9vHdEpyj8LG36epc7EYIcTDy2HnYsW2uJwq6v6ehQOkILp654V_ZjttOxfL7d2nnjSmubuZX2_XK8hPxGzTEulKu6OvNnqyp54UIr9ZUviRth7WSzxsSRZeLD9_-XT1Zd4ZrwekBxWPpVG63M4_Xj0Qpbe-XzNeoCg5wj9cGSO5IYe5dQinj4U2KjQ7CeWMf1feOw9WiaDzqFHsr2e13dfCSyW5OAptxE4bHZ-5VSdieopeYLWO15ZgwBFjUaqoPE5PXkNeiB7hgsLvuQiR_1ULg-9SB8IlL7SCfdrqqIXRfysPxkpJ5ETnjWBKZXqRhE62wDOdAC5lJSJPBvCgSg2qLiujcx05QGPiwbt6f6BL7ogqkDycdMwPXKpC1CY2wq1TT7mqIo_PlUpHlh-1jz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