Enable RTTI is not handled in OS X (MacToolChain.cs)

I’m using UE 4.7.6 (built from source).

I need to enable RTTI to use third party libraries (boost, cereal). I set bUseRTTI = true; in *.Build.cs to enable RTTI.
It works on Windows, but on OS X there are bunch of compile time errors show -fno-rtti is on.

Unlike In VCToolChain.cs, there is no code that handles CompileEnvironment.Config.bUseRTTI in MacToolChain.cs.

If I manullay handle CompileEnvironment.Config.bUseRTTI to set -fno-rtti in the MacToolChain.cs then the problem solved.

Is there any special reason you guys didn’t handled it on OS X? or is it just a mistake?

Hey kwonoh,

I looped in another developer and was able to grab information about this.

"RTTI is generally not used in games, due to the amount of extra data it generates and links into your executable, for every polymorphic type, even if you don’t use end up using RTTI on that type.

Game engines usually produce their own runtime reflection solutions which are tuned to the individual needs of the engine, like we do with the UObject system. And so, we probably didn’t have any Mac users who needed that before."

Thanks,

Okay. Is this means you guys not going to change this?

Thanks,

I am sure if we receive enough future demand for the change we would, but currently it is not on the road map.

I would like to be able to enable RTTI on Mac too!

I copied codes that related to RTTI from VCToolChain.cs.

I’d also like the option to enable RTTI for Mac building!

Hey guys,

I have gone ahead and entered a feature request for this issue, UE-20314. I cannot guarantee it will make it, but I can promise I will add as much community interest as is applicable that are interested in seeing this feature added.

Thank you for taking the time to request this feature. Look to our Release Notes in major upcoming releases to updates for this feature request.

Cheers,

I also need this!

Need that too,
that a bummer, I can’t use boost headers (managed_shared_memory.hpp) for that reason :frowning:

I need this too. The answer ignores that we develop games and TOOLS and often we can’t change third-party code.
I think this restriction should be handled as a custom parameter. Thank you.

“RTTI is generally not used in games, due to the amount of extra data it generates and links into your executable, for every polymorphic type, even if you don’t use end up using RTTI on that type.
Game engines usually produce their own runtime reflection solutions which are tuned to the individual needs of the engine, like we do with the UObject system. And so, we probably didn’t have any Mac users who needed that before.”

Also, I just stumbled over ‘Wno-reorder’ in my third party source.
It would be great, if we could add compiler settings to a .cs file to configure the build system for Mac and Win.
I’m not yet sure, what already can be changed with the current version. :slight_smile:

I have entered a feature request for the issue, and that is currently all I can do or provide in the way of getting this implemented. You will be able to track this issue in the very near future publicly so you can vote on this issue to be implemented.

Cheers,

@Andrew, thank you very much.

this currently is an absolute showstopper for me. Almost all libraries I work with use the common concept of dynamic_cast<> all over the place. Not to talk about my own libraries.
Would you please talk with your expert, how I could workaround this problem by modifying the Unreal build system on my Mac?

Best,
Frank

You can track and vote for the issue on our newly announced Unreal Engine Issues tracker. Aside from that, the developer is going to address this issue as resources become available and he can dedicate time to getting a fix.

A simple solution is open MacToolChain.cs and remove all -fno-rtti

@anonymous_user_373d0814
Thank you, I can’t find this file, where is it located?

I am using the engine that built from source not the prebuilt one via the launcher.
UnrealEngine-4.12.5-release/Engine/Source/Programs/UnrealBuildTool/Mac/MacToolChain.cs

That’s the problem. This file doesn’t exist in the standard launcher installation. It’s a pity, it would be so easy to solve my problem, if I could change that configuration.