llvm doesn't install any LLVMConfig.cmake file

Bug #1365432 reported by fcole90 on 2014-09-04
54
This bug affects 10 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
High
Unassigned
clang (Ubuntu)
High
Unassigned
llvm (Ubuntu)
High
Unassigned
llvm-defaults (Ubuntu)
High
Unassigned
llvm-toolchain-3.5 (Ubuntu)
High
Unassigned

Bug Description

Cmake cannot find llvm because LLVMConfig.cmake is missing.

fcole90 (fcole90) on 2014-09-04
Changed in llvm (Ubuntu):
status: New → Confirmed
Changed in llvm-defaults (Ubuntu):
status: New → Confirmed
fcole90 (fcole90) wrote :

Confirmed because I have found others complaining about that:
http://mailman.cs.umn.edu/archives/shadow-dev/2012-November/000043.html

fcole90 (fcole90) wrote :

CMake Warning at CMakeLists.txt:253 (FIND_PACKAGE):
  By not providing "FindLLVM.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "LLVM", but
  CMake did not find one.

  Could not find a package configuration file provided by "LLVM" with any of
  the following names:

    LLVMConfig.cmake
    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
  "LLVM_DIR" to a directory containing one of the above files. If "LLVM"
  provides a separate development package or SDK, be sure it has been
  installed.

Searching for system CLANG libraries
Did not find CLANG libraries
Compiler optimization may lead to broken Lapack build.
  If release build produces incorrect results (e.g. svd(rand(4)) is all NaN)
  you should to disable optimization when compiling dlamch.c and slamch.c

but both LLVM, llvm-dev and clang are installed.

Launchpad Janitor (janitor) wrote :

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

Changed in clang (Ubuntu):
status: New → Confirmed
Daniel Agar (dagar) wrote :

This prevents embedding llvm with cmake as described here. http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project

Daniel Llewellyn (diddledan) wrote :

it seems utopic has an evolution of this problem - the file /usr/share/llvm-3.5/cmake/LLVMConfig.cmake exists, but references two other files which don't (as far as my compilation went)

/usr/lib/llvm-3.5/share/llvm/cmake/LLVMExports.cmake and /usr/lib/llvm-3.5/share/llvm/cmake/LLVM-Config.cmake

tags: added: utopic
Daniel Llewellyn (diddledan) wrote :

related: bug #1387011

Daniel Llewellyn (diddledan) wrote :

I worked around this issue by editing the LLVMConfig.cmake file to change line 46:

FROM:
set(LLVM_CMAKE_DIR "/usr/lib/llvm-3.5/share/llvm/cmake")

TO:
set(LLVM_CMAKE_DIR "/usr/share/llvm-3.5/cmake")

Changed in clang (Ubuntu):
importance: Undecided → High
Changed in llvm (Ubuntu):
importance: Undecided → High
Changed in llvm-defaults (Ubuntu):
importance: Undecided → High
Changed in hundredpapercuts:
importance: Undecided → High
status: New → Confirmed
Paweł Bylica (chfast) wrote :

I would like to work on a fix, but I don't know where to start.

I believe llvm-3.5-dev package config is wrong. Can someone tell me how to build this package locally and where those configs are?

Launchpad Janitor (janitor) wrote :

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

Changed in llvm-toolchain-3.5 (Ubuntu):
status: New → Confirmed
Patrik Karisch (patkar) wrote :

Is there any workaround or solution for this? Importance was set as high, but open more than a month since the change..

Changed in llvm-toolchain-3.5 (Ubuntu):
importance: Undecided → High
Sylvestre Ledru (sylvestre) wrote :

I don't have time to work on this but I would be happy to accept a patch for this.

Toby Smithe (tsmithe) wrote :

It's really just a one-line change:

set(LLVM_CMAKE_DIR "/usr/share/llvm-3.6/cmake")

in

/usr/share/llvm-3.6/cmake/LLVMConfig.cmake

(or -3.5, or whatever).

Toby Smithe (tsmithe) wrote :

(That 'set' command happens at line 48 in my version)

John Frankland (frankland) wrote :

Hi,
changing the definition of LLVM_CMAKE_DIR is not sufficient to resolve this,
because the LLVM targets in LLVM-Exports.cmake are not set up properly, leading to this:

(result of a CMakeLists.txt containing 'find_package(LLVM REQUIRED)'):

CMake Error at /usr/share/llvm-3.5/cmake/LLVMExports.cmake:6 (set_property):
  set_property could not find TARGET LLVMSupport. Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  /usr/share/llvm-3.5/cmake/LLVMConfig.cmake:50 (include)
  cmake/modules/SearchInstalledSoftware.cmake:654 (find_package)
  CMakeLists.txt:46 (include)

CMake Error at /usr/share/llvm-3.5/cmake/LLVMExports.cmake:7 (set_property):
  set_property could not find TARGET LLVMAArch64Utils. Perhaps it has not
  yet been created.
Call Stack (most recent call first):
  /usr/share/llvm-3.5/cmake/LLVMConfig.cmake:50 (include)
  cmake/modules/SearchInstalledSoftware.cmake:654 (find_package)
  CMakeLists.txt:46 (include)

This is because the 'Exports' file is full of commands to set properties on the targets,
but the targets are never defined (imported) anywhere.

John Frankland (frankland) wrote :

Sorry, just saw that my comment is a duplicate of bug #1387011

I searched in packages for the FindLLVM.cmake file and found this: http://packages.ubuntu.com/search?searchon=contents&keywords=FindLLVM.cmake&mode=exactfilename&suite=xenial&arch=any

I don't think that's related though.

layus (layus-on) wrote :

llvm-dev provides LLVMConfig.cmake (see http://packages.ubuntu.com/search?mode=exactfilename&suite=xenial&section=all&arch=any&keywords=LLVMConfig.cmake&searchon=contents), which is found by cmake if you use `find_package(LLVM CONFIG)`.
This is enough for LLVM to find its components and such.

However, the bug is still not solved for Clang. I think the correct bug for Clang is https://bugs.launchpad.net/ubuntu/+source/clang/+bug/1365434

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers