llvm cmake files incorrectly generated

Bug #1387011 reported by Daniel Llewellyn on 2014-10-29
52
This bug affects 10 people
Affects Status Importance Assigned to Milestone
LLVM
Confirmed
Medium
llvm (Ubuntu)
High
Unassigned
llvm-defaults (Ubuntu)
Undecided
Unassigned
llvm-toolchain-3.5 (Ubuntu)
Undecided
Unassigned
llvm-toolchain-3.8 (Ubuntu)
Undecided
Unassigned

Bug Description

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)
  CMakeLists.txt:129 (find_package)

this message is repeated (many times) for each library/target referenced in the LLVMExports.cmake file.

upstream say they fixed it in svn revision 217484: http://llvm.org/viewvc/llvm-project?view=revision&revision=217484

affects utopic.

In , Dfarler (dfarler) wrote :

Following the instructions at http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project , a simple CMakeLists.txt fails immediately with LLVM 3.5.0 or 3.6.0svn installed at /usr/local, at "find_package(LLVM REQUIRED CONFIG)"

CMake Error at /usr/local/Cellar/llvm/HEAD/share/llvm/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/local/share/llvm/cmake/LLVMConfig.cmake:50 (include)
  CMakeLists.txt:4 (find_package)

similarly for all set_property calls in LLVMExports.cmake.

This fails for CMake 2.8- and 3.0 series.

In , E-dln-l (e-dln-l) wrote :

A patch to fix this has been committed in r217484.

Can you confirm that the issue is fixed for you? If so I can close this PR.

Daniel Llewellyn (diddledan) wrote :

this issue is only reproducible by first fixing issue #1365432

Daniel Llewellyn (diddledan) wrote :

so I got the format for the buglink wrong in the previous comment: bug #1365432

Pim Vullers (pimvullers) wrote :

I can confirm this issue. Working around bug #1365432 results in this issue. Please include this fix when updating the llvm package.

Changed in llvm (Ubuntu):
status: New → Confirmed
Changed in llvm (Ubuntu):
importance: Undecided → High

AFAIK this is fixed

In , E-dln-l (e-dln-l) wrote :

I think so. I'll close it.

Changed in llvm:
importance: Unknown → Medium
status: Unknown → Fix Released
In , Paweł Bylica (chfast) wrote :

I've installed llvm-3.6-dev package from http://llvm.org/apt/ and the problem is still there. Do you know if the fix (r217484?) is included in the 3.6 release? How can I check it?

In , E-dln-l (e-dln-l) wrote :

The patch went into trunk on Wed Sep 10 10:18:59 2014 +0000 so it should be in LLVM3.6 unless someone removed it.

I'm building LLVM3.6 with the autoconfig/Makefile build system now and I'll try installing it and I'll see if I can reproduce the issue.

In , E-dln-l (e-dln-l) wrote :

@Paweł Bylica

Okay I tried building LLVM3.6 with and without ``--enable-shared`` and using the installed LLVM from CMake is working fine for me.

Do you have the LLVM static libraries installed? The exported CMake targets only work with these.

If you take a look at ``/usr/share/llvm/cmake/LLVMExports.cmake``

you'll see stuff like

```
# LLVM CMake target exports. Do not include directly.
add_library(LLVMOption STATIC IMPORTED)
set_property(TARGET LLVMOption PROPERTY IMPORTED_LOCATION "/home/dsl11/dev/llvm3.6/shared_install/lib/libLLVMOption.a")
add_library(LLVMLineEditor STATIC IMPORTED)
set_property(TARGET LLVMLineEditor PROPERTY IMPORTED_LOCATION "/home/dsl11/dev/llvm3.6/shared_install/lib/libLLVMLineEditor.a")
add_library(LLVMIRReader STATIC IMPORTED)
set_property(TARGET LLVMIRReader PROPERTY IMPORTED_LOCATION "/home/dsl11/dev/llvm3.6/shared_install/lib/libLLVMIRReader.a")
...
```

Do the libraries referenced in your version of LLVMExports.cmake exist on your system? If not you need to install them.

In , Paweł Bylica (chfast) wrote :

I will check the details later, and let you know. But I think the problem is not in the build itself (I'm using manually build and it is perfect from 3.5 version). The problem is in config of Debian/Ubuntu package. I installed llvm-3.6-dev package. I think it has moved cmake files from /usr/lib/llvm/share/llvm/cmake to /usr/share/llvm/cmake but some paths points to the old location.

In , E-dln-l (e-dln-l) wrote :

@Paweł Bylica . Sylvestre Ledru is responsible for the Ubuntu/Debian packages. I've CC'ed him on this PR.

```
 I think it has moved cmake files from /usr/lib/llvm/share/llvm/cmake to /usr/share/llvm/cmake but some paths points to the old location.
```

It's the other way round. LLVM installs the CMake files to ``${CMAKE_INSTALL_PREFIX}/share/llvm/cmake/`` and the Ubuntu/Debian packages must be deviating from this.

@Sylvestre. Could you take a look at this?

In , Paweł Bylica (chfast) wrote :

llvm-3.6-dev package has cmake files in /usr/share/llvm-3.6/cmake. There is LLVMConfig.cmake file in that location containing a variable LLVM_CMAKE_DIR set to /usr/lib/llvm-3.6/share/llvm/cmake. That script also fails to load other scripts from the "old" location: `include("${LLVM_CMAKE_DIR}/LLVMExports.cmake")`.

If `find_package(LLVM 3.6 CONFIG)` command used, cmake will search for LLVMConfig.cmake file in /usr/share/llvm-3.6/cmake and /usr/lib/llvm-3.6/cmake. So maybe instead of generating cmake shared files in build-dir/share/llvm/cmake is better to generated them in build-dir/cmake. Then there is not need to move them by package script.

Changed in llvm:
status: Fix Released → Confirmed
Paweł Bylica (chfast) wrote :

This report depends on 2 upstream bugs:

Missing targets in LLVMSupport.cmake - fixed.
https://llvm.org/bugs/show_bug.cgi?id=20884

Incorrect LLVM_CMAKE_DIR - fixed recently.
https://llvm.org/bugs/show_bug.cgi?id=23352

I'm not sure how to add this information to this report properly.

Launchpad Janitor (janitor) wrote :

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

Changed in llvm-defaults (Ubuntu):
status: New → Confirmed
Changed in llvm-toolchain-3.5 (Ubuntu):
status: New → Confirmed
Gordon (gb-i) wrote :

For anyone else who is affected by this issue, I've created this workaround script which repairs the broken cmake files.

Paweł Bylica (chfast) wrote :

The same is for llvm-dev 3.8 in Ubuntu 16.04.

CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:178 (include):
  include could not find load file:

    /usr/share/llvm/cmake/LLVMExports.cmake

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

Other bug subscribers

Remote bug watches

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