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

Krunal Rao krunal.rao78 at gmail.com
Wed May 9 15:03:17 PDT 2012


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....

This should show them all:
http://packages.ubuntu.com/search?keywords=clang&searchon=names&suite=precise&section=all

Thank you in advance for any help / suggestion.



More information about the cfe-dev mailing list