Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake FindPackage error on Ubuntu 18.04.1 x64 #74

Open
HuguesDelorme opened this issue Nov 30, 2018 · 9 comments
Open

CMake FindPackage error on Ubuntu 18.04.1 x64 #74

HuguesDelorme opened this issue Nov 30, 2018 · 9 comments
Assignees
Labels

Comments

@HuguesDelorme
Copy link

When running "cmake . -DCMAKE_BUILD_TYPE=Release" it systematically halts with this error :
CMake Error at generator/CMakeLists.txt:7 (Find_Package):
Could not find a package configuration file provided by "Clang" with any of
the following names:

ClangConfig.cmake
clang-config.cmake

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

I have packages clang + libllvm-6.0 + llvm-6.0 + llvm-6.0-runtime + libclang-6.0-dev + libclang1 + libclang-common-6.0-dev installed

@ogoffart
Copy link
Contributor

ogoffart commented Dec 1, 2018

Does the libclang-6.0-dev package not come with a ClangConfig.cmake file?
Maybe there is a clang-dev package?

You can try to do

find /usr/ -name ClangConfig.cmake

To find if you have the file.

@ogoffart
Copy link
Contributor

ogoffart commented Dec 1, 2018

https://packages.ubuntu.com/search?searchon=contents&keywords=ClangConfig.cmake&mode=exactfilename&suite=cosmic&arch=any
says the package would be clang-6.0

I suppose you would also need to do -DCMAKE_PREFIX_PATH=/usr/lib/llvm-6.0/lib/cmake/clang or someting like that

@HuguesDelorme
Copy link
Author

Hello Olivier,
From what you advised I tried this:
find /usr/ -name ClangConfig.cmake
--> /usr/share/llvm-6.0/cmake/ClangConfig.cmake

cmake . -DCMAKE_PREFIX_PATH=/usr/share/llvm-6.0/cmake
-->
-- Found LLVM 6.0.0 in /usr/lib/llvm-6.0
-- Using LLVMConfig.cmake in: /usr/lib/llvm-6.0/cmake
CMake Error at /usr/share/llvm-6.0/cmake/ClangConfig.cmake:18 (include):
include could not find load file: /usr/lib/cmake/clang/ClangTargets.cmake
Call Stack (most recent call first): generator/CMakeLists.txt:7 (Find_Package)

For info:
find /usr/ -name ClangTargets.cmake
--> /usr/share/llvm-6.0/cmake/ClangTargets.cmake

What could I try to fix this issue?

@f4grx
Copy link

f4grx commented Jan 2, 2019

Hello,
I am also hitting this issue with no solution. Required files are present on my system but not found. Also using clang 6 on mint, with llvm 3.8

me@host ~/code/woboq_codebrowser $ cmake . -DCMAKE_BUILD_TYPE=Release
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
Call Stack (most recent call first):
  generator/CMakeLists.txt:4 (Find_Package)


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

    /usr/share/llvm/cmake/LLVM-Config.cmake
Call Stack (most recent call first):
  generator/CMakeLists.txt:4 (Find_Package)


-- Found LLVM 3.8.0 in /usr
-- Using LLVMConfig.cmake in: /usr/share/llvm-3.8/cmake
CMake Error at generator/CMakeLists.txt:7 (Find_Package):
  Could not find a package configuration file provided by "Clang" with any of
  the following names:

    ClangConfig.cmake
    clang-config.cmake

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


-- Configuring incomplete, errors occurred!

me@host ~/code/woboq_codebrowser $ sudo find / -xdev -name LLVM-Config.cmake
/usr/share/llvm-3.8/cmake/LLVM-Config.cmake

me@host ~/code/woboq_codebrowser $ sudo find / -xdev -name ClangConfig.cmake
/usr/lib/llvm-3.8/share/clang/cmake/ClangConfig.cmake
/usr/share/llvm-6.0/cmake/ClangConfig.cmake

It's not so easy:

me@host ~/code/woboq_codebrowser $ cmake . -DCMAKE_BUILD_TYPE=Release -DClang_DIR=/usr/lib/llvm-3.8/share/clang/cmake/
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
Call Stack (most recent call first):
  generator/CMakeLists.txt:4 (Find_Package)


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

    /usr/share/llvm/cmake/LLVM-Config.cmake
Call Stack (most recent call first):
  generator/CMakeLists.txt:4 (Find_Package)


-- Found LLVM 3.8.0 in /usr
-- Using LLVMConfig.cmake in: /usr/share/llvm-3.8/cmake
CMake Error at generator/CMakeLists.txt:7 (Find_Package):
  Found package configuration file:

    /usr/lib/llvm-3.8/share/clang/cmake/ClangConfig.cmake

  but it set Clang_FOUND to FALSE so package "Clang" is considered to be NOT
  FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing: LLVM



-- Configuring incomplete, errors occurred!
See also "/home/slo/code/woboq_codebrowser/CMakeFiles/CMakeOutput.log".

Now LLVM is declared missing... but it was previously found ?????

@rickywxg
Copy link

This is a debian packaging bug and was fixed in llvm-7.

Please just remove the default llvm-6.0/clang-6.0 packages and install the version 7.
sudo apt install llvm-7 clang-7 libclang-7-dev

driverCzn added a commit to driverCzn/woboq_codebrowser that referenced this issue Feb 25, 2020
Add some notes from KDAB#74 .
ogoffart pushed a commit that referenced this issue Feb 25, 2020
Add some tips for Ubuntu with llvm-6 and clang-6.

Add some notes from #74 .
@Durvi98

This comment was marked as off-topic.

@ogoffart
Copy link
Contributor

Hi @Durvi98
It doesn't look like you are commenting on the right github repository.

@eagerm
Copy link

eagerm commented Jul 11, 2023

On Fedora, the missing packages are installed with "sudo dnf install llvm-devel".

@wetw0rk
Copy link

wetw0rk commented Apr 8, 2024

I was able to build using the following (from the build directory), as of 2024.

  • sudo apt install llvm-15-dev clang-15 libclang-15-dev
  • cmake -DCMAKE_BUILD_TYPE=Release ..
  • make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants