Search code examples
clangllvmxcode7.3

building llvm 3.8 + clang-tools-extra 3.8 with xcodebuild


I'm trying to build and run llvm 3.8 together with the clang and clang-tools-extra. The steps I followed are the ones on LLVM with the difference that I'm using this git mirror to check what I need.

So, shortly, I have:

LLVM 3.8 Clang 3.8 in llvm/tools Clang-tools-extra 3.8 in llvm/tools I can execute:

cmake -G Xcode ../llvm to generate the build files in my 'build' folder, but when I start building llvm with xcodebuild the build fails because in /Users/carlodidomenico/Thesis/git/LLVM/llvm/tools/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h

  • "clang/Basic/Diagnostic.h"
  • "clang/Basic/SourceManager.h"
  • "clang/Tooling/Refactoring.h"

cannot be found

The building phase stops at

=== BUILD TARGET clangTidyCERTModule OF PROJECT LLVM WITH THE DEFAULT CONFIGURATION (Debug) ===

CompileC /Users/carlodidomenico/Thesis/git/LLVM/build_xcode/tools/clang-tools-extra/clang-tidy/cert/LLVM.build/Debug/clangTidyCERTModule.build/Objects-normal/x86_64/CERTTidyModule.o tools/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/carlodidomenico/Thesis/git/LLVM/llvm
    export LANG=en_US.US-ASCII
    /Applications/Xcode7.3/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=80 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wnon-virtual-dtor -Woverloaded-virtual -Wno-exit-time-destructors -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wsign-compare -Wno-shorten-64-to-32 -Wnewline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug\" -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -isysroot /Applications/Xcode7.3/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.11 -g -Wno-sign-conversion -I/Users/carlodidomenico/Thesis/git/LLVM/build_xcode/Debug/lib/include -I/Users/carlodidomenico/Thesis/git/LLVM/build_xcode/tools/clang-tools-extra/clang-tidy/cert -I/Users/carlodidomenico/Thesis/git/LLVM/llvm/tools/clang-tools-extra/clang-tidy/cert -I/Users/carlodidomenico/Thesis/git/LLVM/build_xcode/include -I/Users/carlodidomenico/Thesis/git/LLVM/llvm/include -I/Users/carlodidomenico/Thesis/git/LLVM/build_xcode/tools/clang-tools-extra/clang-tidy/cert/LLVM.build/Debug/clangTidyCERTModule.build/DerivedSources/x86_64 -I/Users/carlodidomenico/Thesis/git/LLVM/build_xcode/tools/clang-tools-extra/clang-tidy/cert/LLVM.build/Debug/clangTidyCERTModule.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/carlodidomenico/Thesis/git/LLVM/build_xcode/Debug/lib -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -std=c++11 -fno-exceptions -fno-rtti -MMD -MT dependencies -MF /Users/carlodidomenico/Thesis/git/LLVM/build_xcode/tools/clang-tools-extra/clang-tidy/cert/LLVM.build/Debug/clangTidyCERTModule.build/Objects-normal/x86_64/CERTTidyModule.d --serialize-diagnostics /Users/carlodidomenico/Thesis/git/LLVM/build_xcode/tools/clang-tools-extra/clang-tidy/cert/LLVM.build/Debug/clangTidyCERTModule.build/Objects-normal/x86_64/CERTTidyModule.dia -c /Users/carlodidomenico/Thesis/git/LLVM/llvm/tools/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp -o /Users/carlodidomenico/Thesis/git/LLVM/build_xcode/tools/clang-tools-extra/clang-tidy/cert/LLVM.build/Debug/clangTidyCERTModule.build/Objects-normal/x86_64/CERTTidyModule.o
In file included from /Users/carlodidomenico/Thesis/git/LLVM/llvm/tools/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp:10:
In file included from /Users/carlodidomenico/Thesis/git/LLVM/llvm/tools/clang-tools-extra/clang-tidy/cert/../ClangTidy.h:13:
/Users/carlodidomenico/Thesis/git/LLVM/llvm/tools/clang-tools-extra/clang-tidy/cert/../ClangTidyDiagnosticConsumer.h:14:10: fatal error: 
      'clang/Basic/Diagnostic.h' file not found
#include "clang/Basic/Diagnostic.h"

Am I doing something wrong or what. It seems such a straightforward sequences of steps to be followed, but something is going wrong.

Initially I thought the problem was with just the "clang/Basic/Diagnostic.h" so I've opened the "LLVM.xcodeproj" with Xcode itself and noticed that "clang/Basic/SourceManager.h" file is not found and "clang/Tooling/Refactoring.h" too.

It seems like all the #include "clan/*" are giving problems


Solution

  • In order to use clang-tools-extra you'd also need to have clang sources. It seems that you prepared your combined source tree improperly. Please consider following the instructions at http://clang.llvm.org/get_started.html