[LLVMdev] using llvm as library from xcode project?

Yuri yuri at rawbw.com
Tue Jan 11 16:57:42 PST 2011


On 01/11/2011 16:16, Rob Nikander wrote:
> I just downloaded and compiled LLVM and I'd like to use the JIT API in
> a project that I've got in Xcode.  I'm confused because I thought I
> could use LLVM like a library, but it seems I can't simply include
> some headers and link to lib, as usual.  Or can I?  I don't see a
> framework or dylib file, which I would usually add to my Xcode
> project.  The /usr/local/lib directory has a bunch of .a files.
>
> This page (http://llvm.org/docs/Projects.html) suggests that I need to
> learn about the LLVM build system.   If so, why?
>
> I tried simply adding all the .a files in /usr/local/lib, but my
> programs fails at:
>
>      engine = EngineBuilder(module).setErrorStr(&err).create();
>
> The 'engine' is null, and 'err' is "Interpreter has not been linked in.".
>    

You don't need XCode to compile llvm.
It's best to supply --enable-shared to configure. This will build you 
libLLVM-2.9svn.dylib. This is the only library you need to link your app 
with.

Yuri



More information about the llvm-dev mailing list