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.
Thanks Takumi and Umesh Kalappa for your reply. Yes, you right.