c++ - How to write Clang plugin makefile with binary download LLVM and Clang? -
i'am new llvm , clang. followed tutorial , tried build clang plugin on pc. tutorial's makefile simple this:
clang_level := ../.. libraryname = pluginexample sources := pluginexample.cpp link_libs_in_shared = 0 shared_library = 1 include $(clang_level)/makefile
however, tutorial's llvm , clang built compiling source, while llvm(and clang) binary online directly(with apt-get install on ubuntu). it's installed in /usr/lib. so, i'm confused clang_level is, mean?
========================================================================= have tried way, seems wrong , have no idea did miss. so, makefile this:
cxx := g++ llvm_dir := /usr/lib/llvm-3.5 llvmconfig := /usr/lib/llvm-3.5/bin/llvm-config plugin = parameternamechecker cxxflags += `${llvm_dir}/bin/llvm-config --cxxflags` ldflags += `${llvm_dir}/bin/llvm-config --ldflags` llvmlibs = `${llvm_dir}/bin/llvm-config --libs` sources = pluginexample.cpp objects = $(sources:.cpp=.o) exes = $(objects:.o=) clanglibs = \ -lclangtooling\ -lclangfrontendtool\ -lclangfrontend\ -lclangdriver\ -lclangserialization\ -lclangcodegen\ -lclangparse\ -lclangsema\ -lclangstaticanalyzerfrontend\ -lclangstaticanalyzercheckers\ -lclangstaticanalyzercore\ -lclanganalysis\ -lclangarcmigrate\ -lclangrewritefrontend\ -lclangrewritecore\ -lclangedit\ -lclangast\ -lclanglex\ -lclangbasic\ $(shell $(llvmconfig) --libs)\ -lcurses $(plugin).so: $(plugin).o $(cxx) $(ldflags) -o $(plugin).so $(plugin).o $(plugin).o: $(plugin).cpp $(cxx) $(cxxflags) -c $(plugin).cpp -o $(plugin).o clean: -rm -fv $(plugin).o $(plugin).so
the compiler complains sort of things undefined reference 'clang::pluginastaction::anchor()'
.
i'd provide more information if necessary.
this may since have built clang on linux os. getting started: building , running clang
Comments
Post a Comment