[cfe-dev] How to add and link new library to the existing clang libraries?
geek4civic at gmail.com
Thu Sep 6 08:03:43 PDT 2012
2012/9/4 Mahesha HS <mahesha.llvm at gmail.com>:
> I want to add and link a new library like libClangOmp.a to the existing
> clang libraries like libClangLex.a/libClangLex.a/etc so that it finally
> becomes a part of libclang.so. What is the basic procedure to do so?
> Currently, I am getting 'undefined reference' linker error to a function
> defined in libClangOmp.a and which is called from libClangLex.a. I must be
> missing something to mention in makefiles?
You have to tweak clang/tools/*/Makefile(s).
For example, tools/libclang/Makefile,
USEDLIBS = clangARCMigrate.a clangRewriteCore.a clangRewriteFrontend.a \
clangFrontend.a clangDriver.a \
clangParse.a clangSema.a clangEdit.a clangAnalysis.a \
clangAST.a clangLex.a clangTooling.a clangBasic.a
You may put your clangOmp.a after clangLex.a, as long as clangLex.a
depends on your clangOmp.a.
clangAST.a clangLex.a clangOmp.a clangTooling.a clangBasic.a
It should be done for each tools/*/Makefile(s).
Note, USELIBS is sensitive to linking order.
More information about the cfe-dev