Error in building clang examples in llvm

Hello all,

I have configured the llvm source code on my machine through following the steps for Unix-like systems ( and am currently trying to run the sample plugin print-fns located in llvm/tools/clang/examples.

According to this discussion ( I should run “make BUILD_EXAMPLES=1 -C tools/clang” in the build directory. When I do that, I get the following error:

llvm[2]: Linking Debug+Asserts executable clang-interpreter
Undefined symbols:
“llvm::ParseIR(llvm::MemoryBuffer*, llvm::SMDiagnostic&, llvm::LLVMContext&)”, referenced from:
clang::CodeGenAction::ExecuteAction() in libclangCodeGen.a(CodeGenAction.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [/Users/V/build/Debug+Asserts/bin/clang-interpreter] Error 1
make[1]: *** [clang-interpreter/.makeall] Error 2
make: *** [examples/.makeall] Error 2

The same happens when I run “make” in the clang/examples/PrintFunctionNames directory in effort to compile the plugin.

Any ideas as to why this occurs?


   That seems to do the trick.
   Could somebody review it?

clang_examples.diff (1.13 KB)