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§ion=all
Thank you in advance for any help / suggestion.
If you build/install clang from source, it should install
libclangAST.a etc. I have no idea what the Debian packages include,
though.
-Eli
Ok, but I wanted to avoid having to build LLVM, Clang ecc ecc as it
does not seems exactly a trivial task at the moment....
If I really need to, what would be the best guide to follow? The
phrase "The LLVM Getting Started documentation may be out of date"
present in the getting started documentation for LLVM worries me a
bit...
Also, on Debian/Ubuntu only llvm-dev and libclang-dev packages are
present (no clang-dev ones) so I am getting very confused...
I would really appreciate the input of some Debian/Ubuntu user here.
Thank you for your reply.
Ok, but I wanted to avoid having to build LLVM, Clang ecc ecc as it
does not seems exactly a trivial task at the moment…
Building llvm/clang is quite easy. Just follow:
http://clang.llvm.org/get_started.html
It's not hard. Just do the following,
Thank you all for the prompt replies!
I am following these steps and it's working, but I have two questions:
- The code listed below builds the Release version (the LLVM getting
started documentation suggested it would build the Debug one). How can
I obtain the Debug version instead?
- What options should I pass to configure (or make) to install LLVM
and Clang into an arbitrary "root" directory? (for "root" I mean the
dir that will contain /bin /lib ecc ecc).
Thanks again.
configure --help
Have a look at --prefix and --enable-optimized
Ben
You can use `${LLVM_SRC}/configure --help` to see what options are available.
A1.
${LLVM_SRC}/configure --enable-optimized=no
A2.
${LLVM_SRC}/configure --prefix=WHAT_DIR_YOU_LIKE
The debug mode is preferred if there is something goes wrong, it can give you
more information.
Regards,
chenwj
As the main (understand: only) maintainer of clang & llvm under Debian &
Ubuntu, I can reply to this question libclang-common-dev is providing
the common headers,
libclang-common-dev should be used when trying to build an application
based on the clang library. libclang1 providing the actual library.
I am not aware of any Debian/Ubuntu packages using yet it but I will be
happy to have any feedbacks/requests on this subject.
Sylvestre
Hi, the issue (if I am not completely wrong) is that libclang1
contains the libclang library but there is no package for the whole
clang library itself. The errors I am getting when trying to link to
clang in my first post are due to libclangAST.a ecc ecc not being
available (that I know of) in any Debian/Ubuntu package.
Kind regards