[LLVMdev] compiling clang with rtti

Olaf Krzikalla Olaf.Krzikalla at tu-dresden.de
Mon Sep 14 23:55:29 PDT 2009


Daniel Dunbar schrieb:
>> Hi @clang,
>> First: why is line 348 commented out? This renders REQUIRES_RTTI
>> useless. Does rtti (llvm) and non-rtti (clang) code work together at
>> all? I had serious trouble when trying this with my own application and
>> eventually resigned .
>>     
>
> Dunno, but I think its fine to fix REQUIRES_RTTI, I'll do so right now
>   
Thank you, this should fix my actual problem.

>> I'm forced to use rtti in my application as it uses some clang libs but
>> also some tr1 stuff (which apparently needs rtti) and boost. This leads
>> me to the second question:
>>     
>
> That doesn't necessarily explain why you are forced to use RTTI (just
> as clang doesn't use RTTI but LLVM does, and only the LLVM parts build
> with RTTI).
>   
Digging deeper into this yields two issues.
First boost function (and gcc's tr1::function implementation) needs
rtti. Two months ago there was a discussion at the boost mailing list
about this requirement (Douglas Gregor was involved) and the conclusion
was that it needs to be working without rtti. However at the moment I
have to go with what we have.
Secondly gcc produces 'missing typeinfo' linker errors if I create a
object (of a class which was defined in a clang lib, e.g. AST) in my own
lib (where rtti is activated). The gcc strategy for creating these
typeinfo objects explains why there is no typeinfo object if the clang
lib is compiled without rtti. I'm not sure if the linker error is
necessary anyway but on the other hand mixing rtti and non-rtti this is
nothing covered by the standard. Thus I have to live with that too.
Eventually my only solution for both points was to turn on rtti for
clang libs.

Best regards
Olaf Krzikalla





More information about the llvm-dev mailing list