<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/127179>127179</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
MinGW-w64 build with MLIR fails
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
brechtsanders
</td>
</tr>
</table>
<pre>
When trying to do a shared build of LLVM with MinGW-w64 (native on Windows in my case using GCC+MinGW-w64 from https://winlibs.com/) the build would always fail when MLIR is included.
After some investigation I noticed some libraries where in the wrong order causing unresolved symbols.
To test this theory I performed the following dirty fix changing their order:
```sh
sed -i.bak -e "s?\(lib/libLLVMTableGen[^ ]*\.a\)\(.*\)\(lib/libMLIRTableGen[^ ]*\.a\)?\3\2\1?" build.ninja
```
With that change the build did succeed.
So the solution would be to put link dependency `libMLIRTableGen` before libraries it depends on (like `libLLVMTableGen`).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEU02PqzgQ_DXm0goyJiRw4JCXtxmNNHPZfdo5G9xAvzF2ZJuw_PuVAc3HXlZCQv7oqnJXl_SeeoNYs-IHK34mcgqDdXXjsB2Cl0ah80lj1VK_DWgguIVMD8GCsiDBD9KhgmYircB28PLy9yvMFAZ4JfP0dphPR2CiNDLQA8EaeCOj7OyBDIwLtNIjTD4iPl2vTPz4rOqcHWEI4e5ZfmHixsRtJqOp8Wlrx3WjgjDgzj3bSSuQepaLh06ShjnKfX15_hMo0rV6UqhSxi-MXy5dQAfejghkHugD9TKQNfAMxgZqUW2HmhonHaGPaC5eXilnZ00P1il00MpN_2QceqsfsXQZG6v9zvXLQkAfIAzkY7V1CzzDHV1n3YhqBeys1naOMIpcWKCjf6AdpOnXXg9IbmOLreAXduLb5wfGLx4VHCht5DscEJgQnuU3VlyZKDU1TNw0NdGWX7LR-IRm9fkPYMVPJi6suKZyvVxtJem2-bH-gIid_F-IlThnxVWw4prFpRCbQakh81t-Fb915y3OShhk2N6LXyxVpMBPbYsftv1l12Nv9bS6tZneYBzH-xRAk3kHhXc0Ck27ADvx_yo_cWiws-6rtxT2Ih8ndH30O-7F3zp34kxUaaLqXFV5JROss3NeFSI7lWUy1GV5PHeZbGV5lpJzLkuUFc_PlVBZmXdFQrXgouAiO_JSlLxMleRd1ZVZEbeLPGNHjqMknWr9GFPr-oS8n7DOxDk7V4mWDWq_JlWIUZNjQsTMujrePzRT79mRa_LBfyIEChrrz2DteVkzGtMRw-KTyen6e9p6CsPU7GGLaPvvcHf2N7aBidsqzjNx2_U9avFvAAAA__-GHGAb">