[cfe-dev] Linking against Clang 3.0 on Ubuntu 12.04 issue

Eli Friedman eli.friedman at gmail.com
Wed May 9 16:04:27 PDT 2012


On Wed, May 9, 2012 at 3:03 PM, Krunal Rao <krunal.rao78 at gmail.com> wrote:
> Hi,
>
> I am trying to compile a C++ program that makes use of the Clang 3.0 API.
> I try to build it and link it with the following command:
>
> clang `llvm-config-3.0 --cxxflags --ldflags --libs`
> recurseVisitAst.cpp -lstdc++ -lm -lpthread -lclangFrontendTool
> -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen
> -lclangParse -lclangSema -lclangStaticAnalyzerCheckers
> -lclangStaticAnalyzerCore -lclangAnalysis -lclangIndex -lclangRewrite
> -lclangAST -lclangLex -lclangBasic
>
> (yes the file has been previously posted on this ml). However this fails with:
>
> /usr/bin/ld: cannot find -lclangFrontendTool
> /usr/bin/ld: cannot find -lclangFrontend
> /usr/bin/ld: cannot find -lclangDriver
> /usr/bin/ld: cannot find -lclangSerialization
> /usr/bin/ld: cannot find -lclangCodeGen
> /usr/bin/ld: cannot find -lclangParse
> /usr/bin/ld: cannot find -lclangSema
> /usr/bin/ld: cannot find -lclangStaticAnalyzerCheckers
> /usr/bin/ld: cannot find -lclangStaticAnalyzerCore
> /usr/bin/ld: cannot find -lclangAnalysis
> /usr/bin/ld: cannot find -lclangIndex
> /usr/bin/ld: cannot find -lclangRewrite
> /usr/bin/ld: cannot find -lclangAST
> /usr/bin/ld: cannot find -lclangLex
> /usr/bin/ld: cannot find -lclangBasic
>
> I am running Ubuntu 12.04 LTS Server and I have installed the packages
> libclang-dev and libclang1, with the latter containing:
>
> /usr/lib/libclang.so (and so.1)
>
> I am clearly missing something (in terms of understanding or in terms
> of files :D) here!
> Should I have libclangAST.a (for instance) somewhere? This file seems
> to be missing from any package in Debian or Ubuntu and no other
> relevant clang package seems to help....

If you build/install clang from source, it should install
libclangAST.a etc.  I have no idea what the Debian packages include,
though.

-Eli



More information about the cfe-dev mailing list