Missing clang headers

Viewed 291

I am trying to compile the Oclgrind project in github but when I run the cmake command I get the next error:

-- Found LLVM 9.0.0
-- Using LLVMConfig.cmake in: /usr/lib/llvm-9/cmake
CMake Error at CMakeLists.txt:112 (message):
  Clang headers not found (set CLANG_ROOT)

when I open the cmakelist.txt file I found out that it is looking for CodeGenAction.h

find_path(CLANG_HEADER "clang/CodeGen/CodeGenAction.h")
if ("${CLANG_HEADER}" STREQUAL "CLANG_HEADER-NOTFOUND")
  message(FATAL_ERROR "Clang headers not found (set CLANG_ROOT)")
endif()

I have several version of llvm and clang installed but I haven't managed to find this file. Also I downloaded the pre-compiled binaries of clang+llvm and I do see this header there. the OclProject has a flag LLVM_DIR which configs in installation dir, but it is not working (I guess that cmake recognize that I have llvm in the system and trying to use it and not the LLVM_DIR flag that I gave)...

  1. Why the installation of clang/llvm on ubuntu doesn't installing the clang headers as well (as I see in the downloaded pre-compiled files)?
  2. How can I install those headers in my ubutnu (I have several version of clang and llvm)
1 Answers

First, in my system I'm required to use use LLVM 11. Check https://apt.llvm.org/ for this.

After installing LLVM 11, I still got the same error, but I could fix it by installing

sudo apt install libclang-11-dev

Related