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

    <tr>
        <th>Summary</th>
        <td>
            Failure to install libMLIR.so when LLVM_DYLIBs and TOOLCHAIN_ONLY are enabled
        </td>
    </tr>

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

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

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

<pre>
    When I build using the commands below, the resulting installation is missing `libMLIR.so.[version]` and the ` libMLIR.so` symlink to it.  
I am working with 21.1.0-rc2 at the moment.
However, I have reproduced the problem with 20.1.0 as well.

```
cmake src/llvm \
    -DCMAKE_INSTALL_PREFIX=/opt/llvm \
 -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_PARALLEL_LINK_JOBS=1 \
 -DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=gold' \
 -DLLVM_ENABLE_PROJECTS="clang;flang;mlir;openmp" \
 -DLLVM_INCLUDE_BENCHMARKS=OFF \
    -DLLVM_INCLUDE_EXAMPLES=OFF \
 -DLLVM_INCLUDE_TESTS=OFF \
    -DLLVM_BUILD_LLVM_DYLIB=ON \
 -DLLVM_LINK_LLVM_DYLIB=ON \
    -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
 -DLLVM_TARGETS_TO_BUILD=host
make -j16 all
make -j16 install
```

The lack of libMLIR manifests as a failure running `flang-new`:

```
$ /opt/llvm/bin/flang-new --version
/opt/llvm/bin/flang-new: error while loading shared libraries: libMLIR.so.21.1-rc2: cannot open shared object file: No such file or directory
```

And can be verified directly:
```
$ find /opt/llvm -name libMLIR\*
[no output]
```

Manually copying `libMLIR.so.21.1-rc2` and `libMLIR.so` from the build directory to `/opt/llvm/lib/` is sufficient to get `flang-new` working.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VV9v4roT_TT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