Troubles building clang

Hi all,

I'm trying to build clang from the tip of the repo, and am getting the compilation failures denoted below.

LLVM/Clang is at r224688

--- snip ---
/home/zanboor/workspace/llvm/llvm/tools/clang/tools/extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp:49:37: error: no matching constructor for initialization of 'llvm::sys::fs::recursive_directory_iterator'
   for (recursive_directory_iterator I(Directory, ErrorCode), E;
                                     ^ ~~~~~~~~~~~~~~~~~~~~
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:797:12: note: candidate constructor not viable: no known conversion from 'llvm::error_code' to 'std::error_code &' for 2nd argument
   explicit recursive_directory_iterator(const Twine &path, std::error_code &ec)
            ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:796:3: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
   recursive_directory_iterator() {}
   ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:792:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
class recursive_directory_iterator {
       ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:792:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
/home/zanboor/workspace/llvm/llvm/tools/clang/tools/extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp:250:26: error: no matching constructor for initialization of 'llvm::raw_fd_ostream'
     llvm::raw_fd_ostream FileStream(FileName, ErrorInfo, llvm::sys::fs::F_Text);
                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/raw_ostream.h:363:3: note: candidate constructor not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'std::error_code &' for 2nd argument
   raw_fd_ostream(StringRef Filename, std::error_code &EC,
   ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/raw_ostream.h:368:3: note: candidate constructor not viable: no known conversion from 'const char *' to 'int' for 1st argument; dereference the argument with *
   raw_fd_ostream(int fd, bool shouldClose, bool unbuffered=false);
   ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/raw_ostream.h:324:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided
class raw_fd_ostream : public raw_ostream {
       ^
/home/zanboor/workspace/llvm/llvm/tools/clang/tools/extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp:266:16: error: no viable conversion from 'std::error_code' to 'llvm::error_code'
     error_code Error = llvm::sys::fs::remove(*I);
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/llvm/Support/system_error.h:724:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'std::error_code' to 'const llvm::error_code &' for 1st argument
class error_code {
       ^
/usr/local/include/llvm/Support/system_error.h:724:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'std::error_code' to 'llvm::error_code &&' for 1st argument
class error_code {
       ^
/usr/local/include/llvm/Support/system_error.h:739:22: note: candidate template ignored: disabled by 'enable_if' [with E = std::error_code]
                      is_error_code_enum<E>::value
                      ^
--- snip ---

Note: was able to build tip circa last Wednesday.

Hi all,

I'm trying to build clang from the tip of the repo, and am getting the
compilation failures denoted below.

Just in case you've not figured out the problem by now...

LLVM/Clang is at r224688

--- snip ---
/home/zanboor/workspace/llvm/llvm/tools/clang/tools/extra/
clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp:49:37: error:
no matching constructor for initialization of 'llvm::sys::fs::recursive_
directory_iterator'
  for (recursive_directory_iterator I(Directory, ErrorCode), E;
                                    ^ ~~~~~~~~~~~~~~~~~~~~
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:797:12:
note: candidate constructor not viable: no known conversion from
'llvm::error_code' to 'std::error_code &' for 2nd argument
  explicit recursive_directory_iterator(const Twine &path,
std::error_code &ec)
           ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:796:3:
note: candidate constructor not viable: requires 0 arguments, but 2 were
provided
  recursive_directory_iterator() {}
  ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:792:7:
note: candidate constructor (the implicit move constructor) not viable:
requires 1 argument, but 2 were provided
class recursive_directory_iterator {
      ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/FileSystem.h:792:7:
note: candidate constructor (the implicit copy constructor) not viable:
requires 1 argument, but 2 were provided
/home/zanboor/workspace/llvm/llvm/tools/clang/tools/extra/
clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp:250:26: error:
no matching constructor for initialization of 'llvm::raw_fd_ostream'
    llvm::raw_fd_ostream FileStream(FileName, ErrorInfo,
llvm::sys::fs::F_Text);
                         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/raw_ostream.h:363:3:
note: candidate constructor not viable: no known conversion from
'std::string' (aka 'basic_string<char>') to 'std::error_code &' for 2nd
argument
  raw_fd_ostream(StringRef Filename, std::error_code &EC,
  ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/raw_ostream.h:368:3:
note: candidate constructor not viable: no known conversion from 'const
char *' to 'int' for 1st argument; dereference the argument with *
  raw_fd_ostream(int fd, bool shouldClose, bool unbuffered=false);
  ^
/home/zanboor/workspace/llvm/llvm/include/llvm/Support/raw_ostream.h:324:7:
note: candidate constructor (the implicit copy constructor) not viable:
requires 1 argument, but 3 were provided
class raw_fd_ostream : public raw_ostream {
      ^

Your build setup is finding one copy of the LLVM headers
in /home/zanboor/workspace/llvm/llvm/include/llvm ...

/home/zanboor/workspace/llvm/llvm/tools/clang/tools/extra/
clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp:266:16: error:
no viable conversion from 'std::error_code' to 'llvm::error_code'
    error_code Error = llvm::sys::fs::remove(*I);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/llvm/Support/system_error.h:724:7: note: candidate
constructor (the implicit copy constructor) not viable: no known conversion
from 'std::error_code' to 'const llvm::error_code &' for 1st argument
class error_code {
      ^

... and another copy in /usr/local/include/llvm.

This is resulting in mismatched versions of LLVM headers being used in the
same compile, which is almost certainly why your build is failing.