ClangConfig.cmake in bad directory

Bug #1694845 reported by Braedy Kuzma
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
llvm-toolchain-4.0 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Description: Ubuntu 16.04.2 LTS
Release: 16.04

clang-4.0:
  Installed: 1:4.0~svn303688-1~exp1
  Candidate: 1:4.0~svn304242-1~exp1
  Version table:
     1:4.0~svn304242-1~exp1 500
        500 http://apt.llvm.org/xenial llvm-toolchain-xenial-4.0/main amd64 Packages
 *** 1:4.0~svn303688-1~exp1 100
        100 /var/lib/dpkg/status

First, I want to note that my clang-4.0 is from llvm's package and not this package that I'm linked to, but in my (limited) understanding I feel like this error is going to occur both ways. Please correct me if I'm wrong.

ClangConfig.cmake is installed in `/usr/share/llvm-4.0/cmake/ClangConfig.cmake` which is not by default searched by cmake and needs to be remedied by adding a PATHS option to the typical find_package command (i.e. `find_package(Clang REQUIRED CONFIG PATHS "/usr/share/llvm-4.0/cmake/")`). The /usr directory isn't listed in any of the list of directories searched here https://cmake.org/cmake/help/v3.8/command/find_package.html, so this choice seems a little odd to me.

Having remedied this by adding the option another error occurs with the final line of ClangConfig.cmake where it attempts to `include(${CLANG_CMAKE_DIR}/ClangTargets.cmake")`. This fails because earlier CLANG_MAKE_DIR is set through `set(CLANG_CMAKE_DIR "${CLANG_INSTALL_PREFIX}/lib/cmake/clang")` where CLANG_INSTALL_PREFIX has been resolved earlier to be `/usr`. The file `/usr/lib/cmake/clang/ClangMakeTargets.cmake` actually exists at `/usr/share/llvm-4.0/cmake/ClangTargets.cmake`.

My first guess is that it was built in one directory and moved here since the file seems to be a templated file like this https://github.com/llvm-mirror/clang/blob/master/cmake/modules/ClangConfig.cmake.in that gets built by this file https://github.com/llvm-mirror/clang/blob/master/cmake/modules/CMakeLists.txt#L22.

Tags: clang cmake
Revision history for this message
Braedy Kuzma (puckmaster-84) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in llvm-toolchain-4.0 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.