Is there any documentation about which libraries are to be used to link executables for Clang?
John
Dr John P. Fletcher Tel: (44) 121 204 3389 (direct line), FAX: (44) 121 204 3678
Chemical Engineering and Applied Chemistry (CEAC),
Associate Dean - External Relations,
School of Engineering and Applied Science (EAS),
Aston University, Aston Triangle, BIRMINGHAM B4 7ET U.K.
If you run clang with --verbose, you can see exactly how clang invokes
the linker.
-Eli
Eli
Thank you.
I should explain my reason a bit more. I wanted to document the version of Clang in my code.
I found this was in the header clang/Basic/Version.h and put that into my code.
I found a routine there called getClangFullVersion() which I called in my code.
I then need to link a library for it which is -lclangBasic but that is not enough.
As well I need -lLLVMSupport -lpthread -ldl to avoid linker errors.
All this I have found by trial and error.
Is there documentation about which LLVM library does which to link a Clang program?
Thank you
John
Ah. For the clang libs, there aren't any docs, but roughly, if you
use a header from clang/Basic, you need libclangBasic.a, etc. The
current complete list of clang libs used to build the clang
executable:
USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \
clangSerialization.a clangCodeGen.a clangParse.a clangSema.a \
clangStaticAnalyzerFrontend.a clangStaticAnalyzerCheckers.a \
clangStaticAnalyzerCore.a \
clangAnalysis.a clangIndex.a clangRewrite.a \
clangAST.a clangLex.a clangBasic.a
For the non-clang libs, there the very useful llvm-config program,
which figures out the necessary LLVM libs; use `llvm-config --ldflags`
to grab the basic link flags, plus `llvm-config --libs` to grab the
LLVM libraries (see http://llvm.org/cmds/llvm-config.html for the docs
for that).
-Eli