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

    <tr>
        <th>Summary</th>
        <td>
            Unable to use LLVM 16 as a library from apt.llvm.org
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            packaging,
            platform:linux
      </td>
    </tr>

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

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

<pre>
    Installing the `llvm-dev` package for LLVM 16 from apt.llvm.org, then attempting to use LLVM as a CMake library using `find_package(LLVM 16 REQUIRED CONFIG)` always fails with the following error:

```
CMake Error at /usr/lib/llvm-16/lib/cmake/llvm/LLVMExports.cmake:1649 (message):
  The imported target "clangdRemoteIndexProto" references the file
     "/usr/lib/llvm-16/lib/libclangdRemoteIndexProto.a"
  but this file does not exist.  Possible reasons include:
  * The file was deleted, renamed, or moved to another location.
```

I don't have enough cmake knowledge to be sure of the cause, but i *assume*  this to be caused by (or related to) https://reviews.llvm.org/D131593.
Since that changed `generate_protos` to call `add_llvm_library`, and `generate_protos` is used by https://github.com/llvm/llvm-project/blob/894c0e94f9c62413feef88fd577c430839abaea7/clang-tools-extra/clangd/index/remote/CMakeLists.txt, those now appear in the `LLVM_AVAILABLE_LIBS` list in `/lib/cmake/llvm/LLVMConfig.cmake`.
This can be manually verified by the existence of those entries in the cmake file, which were not there in previous versions.

Note that installing clangd alongside LLVM also fails, presumably because the LLVM cmake config is looking for packages under `/usr/lib/llvm-16/`, but clangd is installed somewhere else.

I am using `ubuntu-22.04` (jammy) in GitHub actions (of which I can provide the build file in case further reproduction is required), but I was able to note the existence of `clangd` entries in the LLVM config for other distributions as well.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVdtu2zgQ_Rr5hYggS_JFD35wnLhrwO1208urQYkjmQ1FeknKl7_fGUpK0m6KxQaGIpvkzDkzZw5LI26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