llvm cmake files incorrectly generated

Bug #1387011 reported by Lucy Llewellyn
52
This bug affects 10 people
Affects Status Importance Assigned to Milestone
LLVM
Confirmed
Medium
llvm (Ubuntu)
Confirmed
High
Unassigned
llvm-defaults (Ubuntu)
Confirmed
Undecided
Unassigned
llvm-toolchain-3.5 (Ubuntu)
Confirmed
Undecided
Unassigned
llvm-toolchain-3.8 (Ubuntu)
New
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.

Tags: utopic
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Lucy Llewellyn (lucyllewy) wrote :

this issue is only reproducible by first fixing issue #1365432

Revision history for this message
Lucy Llewellyn (lucyllewy) wrote :

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

Revision history for this message
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
Revision history for this message
In , Laurent Carlier (lordheavy) wrote :

AFAIK this is fixed

Revision history for this message
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
Revision history for this message
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?

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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?

Revision history for this message
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
Revision history for this message
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.

Revision history for this message
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
Revision history for this message
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.

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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