[cfe-dev] help needed in compiling tutorial example

Sebastian Redl sebastian.redl at getdesigned.at
Wed Jun 16 01:32:00 PDT 2010


On Wed, 16 Jun 2010 10:36:57 +0530, Nobin Mathew <nobin.mathew at gmail.com>
wrote:
> Hi,
> 
> I am having a compilation issue with tutorial example, please give me
> some directions.
> 
> hash#g++ `/home/nmathew/Desktop/llvm_work/llvm/Debug/bin/llvm-config
> --ldflags` -lLLVMSupport -lLLVMSystem -lLLVMBitReader -lLLVMBitWriter
> -lclangBasic -lclangLex -lclangDriver -lclangIndex -lclangFrontend
> -lclangDriver -lclangSema -lclangAnalysis -lclangAST -lclangParse -o
> tut01 tut01_pp.o

Where is this tutorial from? The problem here is the command line.
Libraries in *nix systems must be listed in reverse dependency order, i.e.
first a library, then the libraries it depends on. So the llvm-config
invocation must be last, all explicit llvm library directives should be
removed in favor of appropriate llvm-config arguments (it ensures correct
ordering), and the Clang libraries must be correctly ordered and come
before the LLVM stuff.

An order that ought to work for Clang is Driver, Frontend, Analysis,
Index, Sema, AST, Parse, Lex, Basic, although recent trunk changes have
changed the dependencies between Frontend and some other modules.

We *really* need a clang-config tool or teach llvm-config to deal with
Clang libraries.

Sebastian




More information about the cfe-dev mailing list