KDAB / codebrowser

Woboq CodeBrowser
http://woboq.com/codebrowser.html
Other
1.1k stars 161 forks source link

CMake FindPackage error on Ubuntu 18.04.1 x64 #74

Open HuguesDelorme opened 5 years ago

HuguesDelorme commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

Durvi98 commented 3 years ago

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)

ogoffart commented 3 years ago

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

eagerm commented 1 year ago

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

wetw0rk commented 7 months ago

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