[cfe-dev] Errors building clang plugin on Max OS

Nico Weber thakis at chromium.org
Mon Mar 7 14:14:47 PST 2011


You're probably listing your libraries in the wrong order. How do you
build your plugin? Does running `make` in
llvm/tools/clang/examples/PrintFunctionNames work for you? If so, you
might want to consider reusing that makefile.

Nico

On Mon, Mar 7, 2011 at 1:55 PM, Hao Jiang <hjian001 at fiu.edu> wrote:
> Hello everyone,
> I am working on a clang plugin to translate c++ source code. It can be built
> on Ubuntu OS without any problems. But when I tried to build it on Mac OS.
> It output error messages:
> llvm[0]: Compiling SourceCodexlate.cpp for Debug+Asserts build (PIC)
> SourceCodexlate.cpp: In member function ‘void
> rtssf::SourceCodexlateConsumer::RewriteProcedureDeclare(rtssf::Function*)’:
> SourceCodexlate.cpp:451: warning: suggest a space before ‘;’ or explicit
> braces around empty body in ‘while’ statement
> SourceCodexlate.cpp:456: warning: suggest a space before ‘;’ or explicit
> braces around empty body in ‘while’ statement
> SourceCodexlate.cpp: In member function ‘void
> rtssf::SourceCodexlateConsumer::RewriteProcedureDefine(rtssf::Function*)’:
> SourceCodexlate.cpp:587: warning: suggest a space before ‘;’ or explicit
> braces around empty body in ‘while’ statement
> SourceCodexlate.cpp:648: warning: suggest a space before ‘;’ or explicit
> braces around empty body in ‘while’ statement
> SourceCodexlate.cpp: In member function ‘void
> rtssf::SourceCodexlateConsumer::RewriteFunctionBody(clang::Stmt*,
> rtssf::Function*, int&)’:
> SourceCodexlate.cpp:773: warning: suggest a space before ‘;’ or explicit
> braces around empty body in ‘while’ statement
> SourceCodexlate.cpp:799: warning: suggest a space before ‘;’ or explicit
> braces around empty body in ‘while’ statement
> SourceCodexlate.cpp:800: warning: suggest a space before ‘;’ or explicit
> braces around empty body in ‘while’ statement
> llvm[0]: Linking Debug+Asserts Shared Library libSourceCodexlate.dylib
> Undefined symbols:
>  "llvm::APInt::initSlowCase(llvm::APInt const&)", referenced from:
>      llvm::APInt::APInt(llvm::APInt const&)in SourceCodexlate.o
>  "clang::FrontendAction::FrontendAction()", referenced from:
>      clang::ASTFrontendAction::ASTFrontendAction()in SourceCodexlate.o
>  "clang::SourceManager::getFileCharacteristic(clang::SourceLocation)
> const", referenced from:
>      clang::SourceManager::isInSystemHeader(clang::SourceLocation) constin
> SourceCodexlate.o
>      clang::SourceManager::isInExternCSystemHeader(clang::SourceLocation)
> constin SourceCodexlate.o
>  "clang::ASTConsumer::HandleTopLevelDecl(clang::DeclGroupRef)", referenced
> from:
>      vtable for rtssf::SourceCodexlateConsumerin SourceCodexlate.o
>  "clang::FrontendAction::~FrontendAction()", referenced from:
>      clang::ASTFrontendAction::~ASTFrontendAction()in SourceCodexlate.o
>  "clang::DeclarationName::getAsString() const", referenced from:
>      clang::NamedDecl::getNameAsString() constin SourceCodexlate.o
>  "vtable for clang::ASTFrontendAction", referenced from:
>   ::~ASTFrontendAction()in SourceCodexlate.o
>      clang::ASTFrontendAction::ASTFrontendAction()in SourceCodexlate.o
>  "clang::StmtIteratorBase::NextVA()", referenced from:
>      clang::StmtIteratorImpl::operator++()in SourceCodexlate.o
>      clang::StmtIteratorImpl::operator++()in SourceCodexlate.o
> ...
>   clang::ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make: ***
> [/Users/ZQ/project/xlate/llvm/Debug+Asserts/lib/libSourceCodexlate.dylib]
> Error 1
> How could I fix these undefined errors? Any suggestion is appreciated.
> Hao Jiang
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/Errors-building-clang-plugin-on-Max-OS-tp2648142p2648142.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list