[cfe-dev] Linking options

Eli Friedman eli.friedman at gmail.com
Wed May 28 05:09:35 PDT 2008


On Wed, May 28, 2008 at 4:52 AM, Paolo Bolzoni <bolzoni at cs.unipr.it> wrote:
> Here a very simple program, t.cc:
> Compiling command (taken almost one-to-one from clang executable linking):
> g++ -o /dev/null \
> t.cc \
> -lclangCodeGen \
> -lclangAnalysis \
> -lclangRewrite \
> -lclangSEMA \
> -lclangAST \
> -lclangParse \
> -lclangLex \
> -lclangBasic \
> -lLLVMCore \
> -lLLVMSupport \
> -lLLVMSystem \
> -lLLVMBitWriter \
> -lLLVMBitReader \
> -lLLVMCodeGen \
> -lLLVMTarget \
> -lpthread \
> -ldl \
> -lm \
> -lelf
> What am I doing wrong?

Try putting your libraries in the following order: -lclangCodeGen
-lclangAnalysis -lclangRewrite -lclangSEMA -lclangAST -lclangParse
-lclangLex -lclangBasic -lLLVMBitWriter -lLLVMBitReader -lLLVMCodeGen
-lLLVMTarget -lLLVMSupport -lLLVMCore -lLLVMSystem -lpthread -ldl -lm

I'm not entirely sure how clang avoids running into this; I don't know
very much about linker magic.

-Eli



More information about the cfe-dev mailing list