KDAB / codebrowser

Woboq CodeBrowser

Home Page:http://woboq.com/codebrowser.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake FindPackage error on Ubuntu 18.04.1 x64

HuguesDelorme opened this issue · comments

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

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.

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

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?

commented

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 ?????

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

commented

please i always get this error while typying my code no matter what i do, i need help
ubuntu@ubuntu:/desktop/build$ cmake .. -DCMAKE_INSTALL_PREFIX=/nextcloud-desktop-client -DCMAKE_BUILD_TYPE=Debug
-- Build of crashreporter disabled.
-- GIT_SHA1 7e3b366a897b6865d23a007a3a100198ddd30fd4
Compiling without updater
CMake Error at /snap/cmake/876/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR) (Required is at least version "1.1")
Call Stack (most recent call first):
/snap/cmake/876/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/snap/cmake/876/share/cmake-3.20/Modules/FindOpenSSL.cmake:570 (find_package_handle_standard_args)
CMakeLists.txt:192 (find_package)

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

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

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