[LLVMdev] Linking to the LLVM shared library

nobled nobled at dreamwidth.org
Sun Aug 22 07:58:32 PDT 2010

Óscar Fuentes <ofv at wanadoo.es> wrote:
> The following message is a courtesy copy of an article
> that has been posted to gmane.comp.compilers.llvm.devel as well.
> nobled <nobled at dreamwidth.org> writes:
>>> AFAIK, the `configure&make' build had so-so support for shared
>>> libraries. Maybe that is fixed now. What they implemented recently was
>>> one option for generating a single shared library containing all LLVM.
>> Right, that was my original question--when you build libLLVM2.7.so
>> with --enable-shared, LLVM's own tools link against it, but how do you
>> link third-party sources against it (instead of the individual shared
>> libs)? Is there an llvm-config option that will give the
>> cflags/ldflags for that? (and if there isn't, would it be easy to add
>> one for 2.8?)
> If the library file name is libLLVM2.7.so just add -lLLVM2.7 instead
> of the usual list of LLVM libraries to the link command.

I realize that, but that's a workaround that requires assuming I know
what version I'm linking against, what -L directory it was installed
in, and that it was definitely named libLLVM(versionnumber). That's
all information that llvm-config can provide automagically for the
static libs (I mean, I could just add a bunch of -lLLVM{module}s in
their case too, but I'd rather not..), but it doesn't ATM for the
shared lib.

More information about the llvm-dev mailing list