<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="line-height: 23.7999992370605px;">Hi! I'am new to LLVM and Clang. I just followed this [tutorial](https://kevinaboos.wordpress.com/2013/07/29/clang-tutorial-part-iii-plugin-example/) and tried to build a Clang plugin on my PC. </div><div style="line-height: 23.7999992370605px;">The tutorial's makefile is simple like this:</div><div style="line-height: 23.7999992370605px;"><br></div><div style="line-height: 23.7999992370605px;">    CLANG_LEVEL := ../..</div><div style="line-height: 23.7999992370605px;">    LIBRARYNAME = PluginExample</div><div style="line-height: 23.7999992370605px;"> </div><div style="line-height: 23.7999992370605px;">    SOURCES := PluginExample.cpp</div><div style="line-height: 23.7999992370605px;"> </div><div style="line-height: 23.7999992370605px;">    LINK_LIBS_IN_SHARED = 0</div><div style="line-height: 23.7999992370605px;">    SHARED_LIBRARY = 1</div><div style="line-height: 23.7999992370605px;"> </div><div style="line-height: 23.7999992370605px;">    include $(CLANG_LEVEL)/Makefile</div><div style="line-height: 23.7999992370605px;"><br></div><div style="line-height: 23.7999992370605px;">However, this tutorial's LLVM and Clang is built by compiling the source, while I get LLVM(and Clang) binary online directly(with apt-get install on Ubuntu). It's installed in /usr/lib. So, I'm confused where my CLANG_LEVEL is, what does it exactly mean?</div><div style="line-height: 23.7999992370605px;"><br></div><div style="line-height: 23.7999992370605px;">=========================================================================</div><div style="line-height: 23.7999992370605px;">I have tried another way, but it seems to be wrong and I have no idea what did I miss. So, the makefile is like this:</div><div style="line-height: 23.7999992370605px;"><br></div><div style="line-height: 23.7999992370605px;">    CXX := g++</div><div style="line-height: 23.7999992370605px;">    LLVM_DIR := /usr/lib/llvm-3.5</div><div style="line-height: 23.7999992370605px;">    LLVMCONFIG := /usr/lib/llvm-3.5/bin/llvm-config</div><div style="line-height: 23.7999992370605px;">    PLUGIN = ParameterNameChecker</div><div style="line-height: 23.7999992370605px;">    </div><div style="line-height: 23.7999992370605px;">    CXXFLAGS += `${LLVM_DIR}/bin/llvm-config --cxxflags`</div><div style="line-height: 23.7999992370605px;">    LDFLAGS += `${LLVM_DIR}/bin/llvm-config --ldflags`</div><div style="line-height: 23.7999992370605px;">    LLVMLIBS = `${LLVM_DIR}/bin/llvm-config --libs`</div><div style="line-height: 23.7999992370605px;">    </div><div style="line-height: 23.7999992370605px;">    SOURCES = PluginExample.cpp</div><div style="line-height: 23.7999992370605px;">    OBJECTS = $(SOURCES:.cpp=.o)</div><div style="line-height: 23.7999992370605px;">    EXES = $(OBJECTS:.o=)</div><div style="line-height: 23.7999992370605px;">    </div><div style="line-height: 23.7999992370605px;">    CLANGLIBS = \</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                               </span>-lclangTooling\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                              </span>-lclangFrontendTool\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                         </span>-lclangFrontend\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                             </span>-lclangDriver\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                               </span>-lclangSerialization\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                                </span>-lclangCodeGen\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                              </span>-lclangParse\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                                </span>-lclangSema\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                         </span>-lclangStaticAnalyzerFrontend\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                               </span>-lclangStaticAnalyzerCheckers\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                               </span>-lclangStaticAnalyzerCore\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                           </span>-lclangAnalysis\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                             </span>-lclangARCMigrate\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                           </span>-lclangRewriteFrontend\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                              </span>-lclangRewriteCore\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                          </span>-lclangEdit\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                         </span>-lclangAST\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                          </span>-lclangLex\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                          </span>-lclangBasic\</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">                                </span>$(shell $(LLVMCONFIG) --libs)\</div><div style="line-height: 23.7999992370605px;">                    -lcurses</div><div style="line-height: 23.7999992370605px;">    </div><div style="line-height: 23.7999992370605px;">    $(PLUGIN).so: $(PLUGIN).o</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;"> </span>$(CXX) $(LDFLAGS) -o $(PLUGIN).so $(PLUGIN).o</div><div style="line-height: 23.7999992370605px;">    </div><div style="line-height: 23.7999992370605px;">    $(PLUGIN).o: $(PLUGIN).cpp</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;"> </span>$(CXX) $(CXXFLAGS) -c $(PLUGIN).cpp -o $(PLUGIN).o</div><div style="line-height: 23.7999992370605px;">    </div><div style="line-height: 23.7999992370605px;">    clean:</div><div style="line-height: 23.7999992370605px;">    <span class="Apple-tab-span" style="white-space: pre;">        </span>-rm -fv $(PLUGIN).o $(PLUGIN).so</div><div style="line-height: 23.7999992370605px;"><br></div><div style="line-height: 23.7999992370605px;">The compiler always complains sort of things like `undefined reference to 'clang::PluginASTAction::anchor()'`.</div><div style="line-height: 23.7999992370605px;"><br></div><div style="line-height: 23.7999992370605px;">I'd like to provide more information if necessary. </div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>