[LLVMdev] Help with LLVM 3.2 linking error

Óscar Fuentes ofv at wanadoo.es
Mon Mar 18 10:47:27 PDT 2013

Nicola Gigante <nicola.gigante at gmail.com> writes:

> Il giorno 18/mar/2013, alle ore 15:14, Óscar Fuentes <ofv at wanadoo.es> ha scritto:
>> Nicola Gigante <nicola.gigante at gmail.com> writes:
>>> The error I get is the following:
>>> Undefined symbols for architecture x86_64:
>>>  "typeinfo for llvm::FoldingSetImpl", referenced from:
>>>      typeinfo for llvm::FoldingSet<Type> in Program.o
>>> ld: symbol(s) not found for architecture x86_64
>>> Looking at the error the question is: is llvm built with RTTI support
>>> by default?
>> No.
>>> If not, how do I enable it?
>> AFAIK, there is no method for enabling RTTI (other than modifying the
>> makefiles).
> Ok, but is it the source of the error? does it comes from the fact
> that I'm linking llvm libraries without rtti with my code that is
> compiled _with_ rtti?

I think so.

> I cannot disable rtti in my code so it's a problem (at least I think so.
> I use dynamic_casts, is -fno-rtti only for typeinfo?)

dynamic_cast depends on RTTI.

> It sounds strange to me, the same used to apply before, but I didn't
> get this error last month with the old setup…
> Any hint?

You can try building LLVM with

CXXFLAGS=-frtti configure ....
CXXFLAGS=-frtti make ...

I'm not sure if CXXFLAGS takes precedence over the hard-coded -fno-rtti
in the makefiles, though.

With the cmake build, you can try as above (but replacing `configure'
with `cmake') or, better:

cmake -DLLVM_REQUIRES_RTTI=ON ... rest of cmake args ...

Adding an option for enabling RTTI on the cmake build is trivial. Dunno
about the `configure' build. You can try filing a feature request on

More information about the llvm-dev mailing list