Error in Tutorial for building tools using LibTooling and LibASTMatchers

Hello everyone,

I’ve been following the Tutorial for building tools using LibTooling and LibASTMatchers:

http://clang.llvm.org/docs/LibASTMatchersTutorial.html

I didn’t accomplish the Step 0 as I had followed the “getting started guide” before to get llvm and clang. Then, everything was right until I reached to the instruction:

cmake -G Ninja ../llvm -DLLVM_BUILD_TESTS=ON

Then, I got the next errors:

– The C compiler identification is GNU 4.6.3
– Check for working C compiler using: Ninja
– Check for working C compiler using: Ninja – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– The CXX compiler identification is GNU 4.6.3
– Check for working CXX compiler using: Ninja
– Check for working CXX compiler using: Ninja – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:23 (include):
include could not find load file:

VersionFromVCS

CMake Error at CMakeLists.txt:153 (include):
include could not find load file:

AddLLVMDefinitions

CMake Error at CMakeLists.txt:239 (include):
include could not find load file:

config-ix

CMake Error at CMakeLists.txt:247 (include):
include could not find load file:

HandleLLVMOptions

– Found PythonInterp: /usr/bin/python (found version “2.7.3”)
– Constructing LLVMBuild project information
CMake Error at CMakeLists.txt:306 (message):
Unexpected failure executing llvm-build: Usage: llvm-build [options]

llvm-build: error: invalid native target: ‘’ (not in project)

– Configuring incomplete, errors occurred!

What’s happening?

By the way, the directory would be …/…/llvm, wouldn’t it? I’m in /usr/llvm/build and when I write …/llvm it says: “The source directory /usr/llvm/llvm does not exist”

Thanks in advance,

Pedro.

If you follow those steps:

mkdir ~/clang-llvm && cd ~/clang-llvm
git clone http://llvm.org/git/llvm.git

You’ll have a directory ~/clang-llvm/llvm

Then, after
cd ~/clang-llvm
mkdir build && cd build

you’ll have a …/llvm directory.

If you change the paths you’ll need to adapt the commands to still work :slight_smile: