compile failure on /cfe/branches/tooling

I'm trying to compile remove-cstr-calls and I get the following linking errors:

Noah-Evanss-MacBook-Pro:remove-cstr-calls npe$ make
llvm[0]: Compiling RemoveCStrCalls.cpp for Debug+Asserts build
llvm[0]: Linking Debug+Asserts executable remove-cstr-calls
Undefined symbols for architecture x86_64:
  "clang::edit::Commit::insertFromRange(clang::SourceLocation,
clang::CharSourceRange, bool, bool)", referenced from:
      __ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
  "clang::edit::Commit::remove(clang::CharSourceRange)", referenced from:
      __ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
  "clang::edit::Commit::replace(clang::CharSourceRange,
llvm::StringRef)", referenced from:
      __ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
  "clang::edit::Commit::insert(clang::SourceLocation, llvm::StringRef,
bool, bool)", referenced from:
      __ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
  "clang::edit::EditedSource::commit(clang::edit::Commit const&)",
referenced from:
      __ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
  "clang::edit::EditedSource::applyRewrites(clang::edit::EditsReceiver&)",
referenced from:
      __ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
  "vtable for clang::edit::EditsReceiver", referenced from:
      clang::edit::EditsReceiver::EditsReceiver() in
libclangFrontend.a(DiagnosticRenderer.o)
  NOTE: a missing vtable usually means the first non-inline virtual
member function has no definition.
  "clang::edit::EditsReceiver::remove(clang::CharSourceRange)", referenced from:
      vtable for (anonymous namespace)::FixitReceiver in
libclangFrontend.a(DiagnosticRenderer.o)
  "clang::edit::rewriteObjCRedundantCallWithLiteral(clang::ObjCMessageExpr
const*, clang::NSAPI const&, clang::edit::Commit&)", referenced from:
      __ZL13checkCocoaAPIRN5clang4SemaEPKNS_15ObjCMessageExprE in
libclangSema.a(SemaExprObjC.o)
  "clang::edit::Commit::Edit::getInsertFromRange(clang::SourceManager&)
const", referenced from:
      __ZL18applyCocoaAPICheckRN5clang4SemaEPKNS_15ObjCMessageExprEjPFbS4_RKNS_5NSAPIERNS_4edit6CommitEE
in libclangSema.a(SemaExprObjC.o)
  "clang::edit::Commit::Edit::getFileRange(clang::SourceManager&)
const", referenced from:
      __ZL18applyCocoaAPICheckRN5clang4SemaEPKNS_15ObjCMessageExprEjPFbS4_RKNS_5NSAPIERNS_4edit6CommitEE
in libclangSema.a(SemaExprObjC.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/npe/src/llvm/Debug+Asserts/bin/remove-cstr-calls] Error 1

It seems to come from not including libclangEdit.a in USEDLIBS, after
I added libclangEdit.a to USEDLIBS the executable linked properly.
Should clangEdit go into the CMakeLists.txt? Am I doing something
wrong?

Noah

I’m trying to compile remove-cstr-calls and I get the following linking errors:

Noah-Evanss-MacBook-Pro:remove-cstr-calls npe$ make
llvm[0]: Compiling RemoveCStrCalls.cpp for Debug+Asserts build
llvm[0]: Linking Debug+Asserts executable remove-cstr-calls
Undefined symbols for architecture x86_64:
“clang::edit::Commit::insertFromRange(clang::SourceLocation,
clang::CharSourceRange, bool, bool)”, referenced from:
__ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
“clang::edit::Commit::remove(clang::CharSourceRange)”, referenced from:
__ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
“clang::edit::Commit::replace(clang::CharSourceRange,
llvm::StringRef)”, referenced from:
__ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
“clang::edit::Commit::insert(clang::SourceLocation, llvm::StringRef,
bool, bool)”, referenced from:
__ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
“clang::edit::EditedSource::commit(clang::edit::Commit const&)”,
referenced from:
__ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
“clang::edit::EditedSource::applyRewrites(clang::edit::EditsReceiver&)”,
referenced from:
__ZL11mergeFixitsN4llvm8ArrayRefIN5clang9FixItHintEEERKNS1_13SourceManagerERKNS1_11LangOptionsERNS_15SmallVectorImplIS2_EE
in libclangFrontend.a(DiagnosticRenderer.o)
“vtable for clang::edit::EditsReceiver”, referenced from:
clang::edit::EditsReceiver::EditsReceiver() in
libclangFrontend.a(DiagnosticRenderer.o)
NOTE: a missing vtable usually means the first non-inline virtual
member function has no definition.
“clang::edit::EditsReceiver::remove(clang::CharSourceRange)”, referenced from:
vtable for (anonymous namespace)::FixitReceiver in
libclangFrontend.a(DiagnosticRenderer.o)
“clang::edit::rewriteObjCRedundantCallWithLiteral(clang::ObjCMessageExpr
const*, clang::NSAPI const&, clang::edit::Commit&)”, referenced from:
__ZL13checkCocoaAPIRN5clang4SemaEPKNS_15ObjCMessageExprE in
libclangSema.a(SemaExprObjC.o)
“clang::edit::Commit::Edit::getInsertFromRange(clang::SourceManager&)
const”, referenced from:
__ZL18applyCocoaAPICheckRN5clang4SemaEPKNS_15ObjCMessageExprEjPFbS4_RKNS_5NSAPIERNS_4edit6CommitEE
in libclangSema.a(SemaExprObjC.o)
“clang::edit::Commit::Edit::getFileRange(clang::SourceManager&)
const”, referenced from:
__ZL18applyCocoaAPICheckRN5clang4SemaEPKNS_15ObjCMessageExprEjPFbS4_RKNS_5NSAPIERNS_4edit6CommitEE
in libclangSema.a(SemaExprObjC.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/npe/src/llvm/Debug+Asserts/bin/remove-cstr-calls] Error 1

It seems to come from not including libclangEdit.a in USEDLIBS, after
I added libclangEdit.a to USEDLIBS the executable linked properly.
Should clangEdit go into the CMakeLists.txt? Am I doing something
wrong?

I just merged mainline. Everything should compile fine now, as long as you use CMake. Let me know if there are still problems…

Thanks for reporting!
/Manuel