Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 496480 - sys-devel/llvm-{3.3-r2,9999} - cmake modules does not work out of box
Summary: sys-devel/llvm-{3.3-r2,9999} - cmake modules does not work out of box
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-30 11:42 UTC by Maciej Piechotka
Modified: 2015-03-20 09:24 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch (cmake-module-path.patch,913 bytes, patch)
2013-12-30 13:57 UTC, Maciej Piechotka
Details | Diff
Patch (llvm-3.3-module.patch,916 bytes, patch)
2014-01-03 09:47 UTC, Maciej Piechotka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Piechotka 2013-12-30 11:42:55 UTC
I've mentioned it in bug #425844 but as it is closed I post a new one. When I try to use LLVM in cmake by:

find_package(LLVM)

it fails:

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

    LLVM-Config
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)

Setting the CMAKE_MODULE_PATH to /usr/share/llvm/cmake/ does not seems to help (I might do something wrong as this is my first project with cmake) but changing:

if( NOT LLVMCONFIG_INCLUDED )
  set(CMAKE_MODULE_PATH
    ${CMAKE_MODULE_PATH}
    "/var/tmp/portage-ondisk/portage/sys-devel/llvm-3.3-r2/work/llvm-3.3.src/cmake/modules")

to

if( NOT LLVMCONFIG_INCLUDED )
  set(CMAKE_MODULE_PATH
    ${CMAKE_MODULE_PATH}
    "/usr/share/llvm/cmake/")

in /usr/share/llvm/cmake/LLVMConfig.cmake works (/var/tmp/portage-ondisk/ is $PORTAGE_TMPDIR)
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-12-30 12:38:24 UTC
Well, it's my first attempt at enabling cmake support with autoconf build, so it may not work :). If you could find a fix to the llvm build that doesn't involve playing with files directly, that would be great.
Comment 2 Maciej Piechotka 2013-12-30 13:57:03 UTC
Created attachment 366546 [details, diff]
Patch

(In reply to Michał Górny from comment #1)
> Well, it's my first attempt at enabling cmake support with autoconf build,
> so it may not work :).

Don't worry. Just in case it wasn't clear - it's me who get something for free.

> If you could find a fix to the llvm build that
> doesn't involve playing with files directly, that would be great.

I'm running the build now with this patch but something like that should work.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-12-31 08:41:02 UTC
Hm, I don't understand what's happening here. I would expect that if it sees LLVMConfig.cmake, it should see other modules from that directory as well...
Comment 4 Maciej Piechotka 2014-01-03 09:47:17 UTC
Created attachment 366818 [details, diff]
Patch

Working patch attached (works from /etc/patches)
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-01-03 10:02:23 UTC
Wouldn't this cause cmake to load some modules from /usr/share/llvm/cmake instead of build-dir when doing the build?
Comment 6 Maciej Piechotka 2014-01-03 10:25:18 UTC
(In reply to Michał Górny from comment #5)
> Wouldn't this cause cmake to load some modules from /usr/share/llvm/cmake
> instead of build-dir when doing the build?

I don't think so although I might be wrong:
 - I assume adding at the end of path makes it the lowest priority
 - Since this is already done by cmake llvm modules I would think such possibility is already taken care by llvm (to start with include(LLVM-Config) might access system installed llvm)
 - It would also occur if dev have 2 llvm builds and one is in path. Given that it is recommended setup (for devel/release builds) I find it unlikely that it would cause problems.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-01-06 13:10:57 UTC
Committed as -r3. Though I'd appreciate if you could play with it a little and find out what we are doing wrong exactly as I don't want to carry hacks indefinitely. You may take a look at existing software that uses LLVM/cmake.
Comment 8 Bernard Cafarelli gentoo-dev 2015-03-20 09:24:23 UTC
Cleaning some old llvm bugs, find_package(LLVM) works fine now :)

(tested with a sample CMakeLists.txt from http://llvm.org/docs/CMake.html#embedding)