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

    <tr>
        <th>Summary</th>
        <td>
            Window MinGW unable to build due to pthread mingw and ldd
        </td>
    </tr>

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

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

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

<pre>
    I am trying to rebuild llvm clang and family to use ldd built with mingw64. This means that clang++ depends on the mingw64 linker. Apparently pthread is needed to build llvm and clang and family. However, llvm doesn't add the -pthread when ninja in generated with cmake so it can. I was able to ctrl + f "  FLAGS = " and add -pthread to build successfully.

In short, explicit -pthread is needed when ldd depends on mingw64.

```bat
git clone --depth 1 --config core.autocrlf=false https://github.com/llvm/llvm-project
pushd llvm-project
cmake -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra;lldb;cross-project-tests" -DCMAKE_INSTALL_PREFIX="C:/llvm/" -DLLVM_USE_LINKER=ldd -DCMAKE_BUILD_TYPE=Release -D -B build -S llvm -G "Ninja"
pushd build
ninja -j 24
popd
popd
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlEFz4jgThn-NfOmyy0jGhIMPEEM-viHZVMjs7J4o2WrbSoTkkuRh-PdbsiHJzm2rKEBSq_vpt1-bOydbjViQ-ZrMy4gPvjO28FK9S-3qqDLiUuyAn8Dbi9QteAMWq0EqAUr9PEGtuG6BawENP0l1CQGDQ1BCQAjzcJa-g5PU7TnPEnjtpIMTcu3Ad9xP9wldE7oGgT1q4cBo8B3e7oCS-h1tAqu-5xa1VxfofWeRC5AONKJAEcp-oQo8v5Ml8D9zxp9oCb2fooRBpwldeOBCjCXjW-Jzhxq01G8cpIYWNVruUUzN1Cf-juAMSA811wns4Mwd8Eph4Ki9VRD6aYBQCrDdrx4OQFg5LgNQKPdR6oPcDXWNzjWDUpeEpCVJV9P3ToPrjPUBHH_1StbSf97_1GCEDsJ_EfIm_Nd8JE-nT8X9tNOGTpTRCHEssPcdzCCOa6Mb2UJtLCZ88Ka2qiGsbLhyCJ33vSNsReiW0G0rfTdUSW1OhG6DuNefuLfmDetrmX5w3TShf-9Pgsblfv_n43HztFrvN8fnlz_-v7l_PRBWEkonm7C1UoKw9biKvTHKxfjLWz6dVOHIGudu2WOPzrugelzeP66-bY67p8Prar8_Pr9stru_ptz3UxdX6il6JPl-2Bz3u6dvmxfCyqDrLcv6-25fHl__ft4QVr6gQu4CPsTr6yjjw-Sw-CHM_Cn4iFD6VYQxbtqYbBa_Ac2uEaYXv__7mFkkCiaWbMkjLGb5Yslms3y-iLpiljV3ObvjTVOxuWg4r1NciCyvFlXTsKyJZEFTylJG09mMLtgiafI5svxumWWVYGm2IFmKJy5VEtgTY9tIOjdgkc_mbBkpXqFy44uCUo1nGA9DW_MyssU41WpoHclSJZ13n1m89AqLH1ILc4ZHqR9-wKBvT8skmBjGxc3To2vHR0UJEQ1WFf_RbnQ70jlCtyP9PwEAAP__M3GVbw">