[LLVMdev] LLVM+Clang as a shared library

Alan Garny agarny at hellix.com
Fri Dec 16 11:29:41 PST 2011


Hi,

I have downloaded version 3.0 of LLVM and Clang and built them as shared
libraries (on Windows, Linux and Mac OS X) using the following steps:

	cd <WHERE-llvm-3.0.tar.gz-IS>
	tar xvzf llvm-3.0.tar.gz
	cd llvm-3.0.src/tools
	tar xvzf ../../clang-3.0.tar.gz
	mv clang-3.0.src clang
	cd ../..
	mkdir build
	cd build
	../llvm-3.0.src/configure --disable-docs --enable-shared
--enable-targets=host
	make

Everything is fine when I test LLVM on its own within my Qt-based
application. However, as soon as I try to test Clang (using the Clang
interpreter example;
http://llvm.org/svn/llvm-project/cfe/trunk/examples/clang-interpreter/), I
get linking errors. For example, undefined references to
clang::TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::raw_ostream&,
clang::DiagnosticOptions const&, bool),
clang::DiagnosticIDs::DiagnosticIDs(),clang::DiagnosticsEngine::DiagnosticsE
ngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> const&,
clang::DiagnosticConsumer*, bool), etc.

What I don't understand is that both LLVM and Clang are built together, yet
only LLVM works for me. Otherwise, yes, I have made sure that my Qt-based
application is built with Clang in mind. In fact, I have done exactly the
same as I have done with LLVM, hence I am really puzzled as what might be
wrong in my setup. However, one thing that I noticed is that, on Windows (at
least), the DLL I have got only contains 159 entries while LLVM contains
13,320. Surely, Clang should contain more than just 159 entries...?!

Anyway, any help I could get regarding the above would be most welcome...

Cheers, Alan.




More information about the llvm-dev mailing list