<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang Analyzer plugin examples always included in LLVMExports.cmake"
   href="https://bugs.llvm.org/show_bug.cgi?id=43430">43430</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang Analyzer plugin examples always included in LLVMExports.cmake
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cmake
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>lepesme.jb@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The clang Analysis plugin examples (in clang/lib/Analysis/plugins) are always
built and installed even if CLANG_BUILD_EXAMPLES is OFF.

When using llvm-toolchain-bionic in <a href="http://apt.llvm.org/bionic/">http://apt.llvm.org/bionic/</a> the package
llvm-10-dev includes a LLVMExports.cmake which includes thus samples. See
/data/user/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake in
<a href="http://apt.llvm.org/bionic/pool/main/l/llvm-toolchain-snapshot/llvm-10-dev_10~svn372305-1~exp1%2b0~20190919071908.1206~1.gbp6f40e3_amd64.deb">http://apt.llvm.org/bionic/pool/main/l/llvm-toolchain-snapshot/llvm-10-dev_10~svn372305-1~exp1%2b0~20190919071908.1206~1.gbp6f40e3_amd64.deb</a>

When trying to use LLVM-10 from travis (with this config
<a href="https://github.com/Jiboo/wembed/blob/54e9664d615313f39e1a4325c1e7f028ce2b72db/.travis.yml">https://github.com/Jiboo/wembed/blob/54e9664d615313f39e1a4325c1e7f028ce2b72db/.travis.yml</a>),
I got the error:

  CMake Error at /usr/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake:1341
(message):
  The imported target "SampleAnalyzerPlugin" references the file
     "/usr/lib/llvm-10/lib/SampleAnalyzerPlugin.so"
  but this file does not exist.  Possible reasons include:
  * The file was deleted, renamed, or moved to another location.
  * An install or uninstall procedure did not complete successfully.
  * The installation package was faulty and contained
     "/usr/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake"
  but not all the files it references.

I couldn't find SampleAnalyzerPlugin.so in any other packages
(clang-10-examples only has sources), so I tried to replicate the problem
locally, CLANG_BUILD_EXAMPLES was OFF, although the sample plugins were built
and installed. Deleting /usr/local/lib/SampleAnalyzerPlugin.so replicated the
travis error.

I proposed a fix here <a href="https://reviews.llvm.org/D67877">https://reviews.llvm.org/D67877</a>.

This fix looks ok to me, although I'm no CMake expert, particularly in LLVM
context, and I might cure a symptom and not the cause, but with this patch if
CLANG_BUILD_EXAMPLES is OFF, they don't appear in LLVMExports.cmake are not
build/installed, and vice-versa if it's ON.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>