Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad_any_cast errors by disabling RTTI when building cesium-native #1468

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

kring
Copy link
Member

@kring kring commented Jul 2, 2024

Fixes #1380

We're seeing bad_any_cast exceptions when loading tilesets with metadata, in release builds, on every platform except Windows. The cause appears to be that cesium-native is compiled with runtime type information (RTTI) enabled, but Cesium for Unreal - as required by Unreal Engine itself - is compiled with RTTI disabled. Windows isn't fussed about this, but apparently it causes subtle problems on Linux/Android/Apple.

kring added 4 commits July 2, 2024 21:35
UE disables it, and apparently on Linux/Android/Apple, mixing libraries
compiled with and without RTTI is a mess.
@kring
Copy link
Member Author

kring commented Jul 3, 2024

This PR also includes a bug fix to the GetInteger64 metadata functions on non-Windows platforms. None of them were working because on 64-bit clang platforms (definitely Linux, pretty sure about the others):

  • std::int64_t is a typedef to signed long int.
  • Unreal's int64 is a typedef to signed long long.

Both are 64-bit and seemingly identical. But they're different types, so IsMetadataInteger<int64> evaluates to false. 🙃

So this PR makes sure we use int64_t instead of int64 when instantiating cesium-native's type traits templates.

@j9liu j9liu self-requested a review July 8, 2024 19:58
@j9liu
Copy link
Contributor

j9liu commented Jul 22, 2024

Thanks @kring !

@j9liu j9liu merged commit 3318683 into main Jul 22, 2024
26 checks passed
@j9liu j9liu deleted the good-any-cast branch July 22, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quest 2/Android build: Unable to parse EXT_structural_metadata extension (or perhaps any extension?)
2 participants