0

I followed this guide to install clang 5.0 on Ubuntu 16.04 build.
I was trying to build a ruby gem source which uses clang 5.0.

However, it can't see certain libs, specifically clang/Lex/Token.h

This was the error produced when running make on the ruby gem source:

>:~/Desktop/ruby/c2ffi/build$ cmake ..
-- Found LLVM 5.0.2
-- LLVM installed in /usr/lib/llvm-5.0
-- Using LLVMConfig.cmake in: /usr/lib/llvm-5.0/cmake
-- Using llvm libs: LLVMCore;LLVMSupport;LLVMMCParser;LLVMOption;LLVMBitReader;LLVMProfileData
-- CMAKE_CXX_FLAGS:  -std=c++11 -fno-exceptions -fno-rtti
-- CMAKE_EXE_LINKER_FLAGS: 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/arjun/Desktop/ruby/c2ffi/build

>:~/Desktop/ruby/c2ffi/build$ make
Scanning dependencies of target c2ffi
[  7%] Building CXX object CMakeFiles/c2ffi.dir/src/Expr.cpp.o
/home/arjun/Desktop/ruby/c2ffi/src/Expr.cpp:22:29: fatal error: clang/Lex/Token.h: No such file or directory
compilation terminated.
CMakeFiles/c2ffi.dir/build.make:62: recipe for target 'CMakeFiles/c2ffi.dir/src/Expr.cpp.o' failed
make[2]: *** [CMakeFiles/c2ffi.dir/src/Expr.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/c2ffi.dir/all' failed
make[1]: *** [CMakeFiles/c2ffi.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I tried to do locate */clang/Lex/*, but it did no return anything, which means the guide I followed to install clang was not absolute.

What is the correct way to install clang 5.0 so that all dependencies can be viewed by any source?

  • 1
    That file appears to be part of the corresponding libclang-x.y-dev package - if you installed clang-5.0 from the llvm.org repository you should be able to install libclang-5.0-dev as well I think? – steeldriver Jun 19 '18 at 14:54
  • Yeah that solved the problem. – arjun Jun 19 '18 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.