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

    <tr>
        <th>Summary</th>
        <td>
            clang-cl not finding libraries when cross compiling Linux -> Windows
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    I have a full visual studio build tools install located in `/opt/msvc`. Theoretically, i should be able to compile with clang-cl just fine with the following command:
`clang-cl /winsdkdir /opt/msvc/kits/10 /vctoolsdir /opt/msvc/vc/tools/msvc/14.32.31326/ /diasdkdir /opt/msvc/DIA\ SDK <file_to_compile> -fuse-ld=lld-link`, but the command fails with the following errors:
```
lld-link: error: could not open 'kernel32.lib': No such file or directory
lld-link: error: could not open 'libucrt.lib': No such file or directory
lld-link: error: could not open 'uuid.lib': No such file or directory
```
`kernel32.lib`, `libucrt.lib` and `uuid.lib` are _**not**_ missing, they are where they should be.

`kernel32.lib` is in `/opt/msvc/kits/10/lib/10.0.19041.0/um/x64/kernel32.lib`.

`libucrt.lib` is in `/opt/msvc/kits/10/lib/10.0.19041.0/ucrt/x64/libucrt.lib`.

`uuid.lib` is in `/opt/msvc/kits/10/lib/10.0.19041.0/um/x64/uuid.lib`.

There are also symlinks present in /opt/msvc, like so:
`/opt/msvc/VC` -> `/opt/msvc/vc`
`/opt/msvc/Windows Kits` -> `/opt/msvc/kits`
`/opt/msvc/vc/Tools` -> `/opt/msvc/vc/tools`
`/opt/msvc/vc/tools/MSVC` -> `/opt/msvc/vc/tools/msvc`
`/opt/msvc/kits/10/Include` -> `/opt/msvc/kits/10/include`

Does clang-cl have issues with the symlinks?

I used [this repo](https://github.com/mstorsjo/msvc-wine) to install the msvc toolchain in linux. While it's supposed to be used under wine, it comes with the complete Windows SDK. 

What is even wierder is that i can cross-compile *rust* programs just fine with this configuration, using lld-link as my linker.

Program versions:
Host OS: Linux 5.18.15 x86_64
clang-cl: 14.0.6
lld: 14.0.6
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVtmO6jgQ_ZrwUiLKQtLhIQ8MDLqtO5vUrduPyIkd4sbEyAs0fz9lEyAwvcxorhR5LZ9aXD6VStJj-Qgt2TMg0FghYM-1JQK0sZRLqCwXFIyUQgPvtCEoIWRNDKM4hyCPgmQpdwbbrd7XOA_huWVSMcNrFD4GyRw46FZaxKlQSyUY4kEttzuOwwM3LdSCdOtxLeDVagMN7_p10zJopBDywLu1O7IlHQ3SWRAtgmiGyi4HUT_KaLqhXMGtSclyw43GLo7czr723rwn5xu_e12LJ2GahGmcJjnO3BHKyQd6Fo-zIJvD0-I7BOm8QfdWRq56T4P0Vxg3VrOxQBcWQtCx4N3GR3COcTbe295HaAjHiL8TBKaUVHoYg_7z0wtqOjtJukHtY99JA3LH8M6Shw1THRPol-AVTp3QHxK0rVtwVoNUgP4xjJQ6_idgxLO1Mj8d11pO_z3oXVBwcOPwKeLYDa3NI3Bxx_6iyy0pBqsgmeGH5pwGK9hyrfEuHApeztFLHVqGrZ9ekj3s9X9gBXD97hsaJCw23mschlEYT6NJHLpFu8XmLZ842VvQe513Pv4PlYhyUXqLeq9zGMGf4uMA8EbXsw-6Cz8RGnPiuHW5pGGnmGad8Zpv1c5B8A0DLW9e0J1pP-bO8rF7se_sepb78OwL76g8aPju3PsEZXPa_xDHN8-eiz635cxYX2Gdee33py_duyPBT5CHl_jY1cJS9qXTvTi_iA9vdCGZvpYDX5fwsVk24MLzLQfpcnjyEZBb8QFnv5gWk06xnQyyRZAUrTE7T5jJEr81wtgqRJ71ZiFp6FfZWzhGhmVBMnX16VzsnEa352tg3RJMKfzQAPsWwkvrCIijhw8aGWm3k84EPI2FzltjO8oUnGCxDhrH70NfXG0QzDA4pw3WjhCGbr20xLhHxPbIhAfOlAPEufHrUJMOaiW1Hp8LKjKUwi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