cesium-o3de
cesium-o3de copied to clipboard
[linux] rapidjson Compilation Error for O3DE 22.10
When trying to compile Cesium O3DE on 22.10 / development, e.g. via https://github.com/CesiumGS/cesium-o3de/pull/45 or https://github.com/CesiumGS/cesium-o3de/pull/50, the compilation will fail with the following error message:
In file included from /root/O3DE/Gems/cesium-o3de/Code/Source/Cesium/Components/TilesetComponent.cpp:34:
In file included from /data/workspace/vendor/packages/CesiumNative/CesiumNative/include/Cesium3DTilesSelection/Tileset.h:19:
/data/workspace/vendor/packages/CesiumNative/CesiumNative/include/rapidjson/fwd.h:116:70: error: typedef redefinition with different types ('GenericValue<[...], MemoryPoolAllocator<>>' vs 'GenericValue<[...], (default) rapidjson_ly::CrtAllocator>')
typedef GenericValue<UTF8<char>, MemoryPoolAllocator<CrtAllocator> > Value;
^
/data/workspace/vendor/packages/CesiumNative/CesiumNative/include/rapidjson/document.h:2485:31: note: previous definition is here
typedef GenericValue<UTF8<> > Value;
^
In file included from /root/O3DE/Gems/cesium-o3de/Code/Source/Cesium/Components/TilesetComponent.cpp:34:
In file included from /data/workspace/vendor/packages/CesiumNative/CesiumNative/include/Cesium3DTilesSelection/Tileset.h:19:
/data/workspace/vendor/packages/CesiumNative/CesiumNative/include/rapidjson/fwd.h:121:86: error: typedef redefinition with different types ('GenericDocument<[...], MemoryPoolAllocator<>, [...]>' vs 'GenericDocument<[...], (default) rapidjson_ly::CrtAllocator, [...]>')
typedef GenericDocument<UTF8<char>, MemoryPoolAllocator<CrtAllocator>, CrtAllocator> Document;
^
/data/workspace/vendor/packages/CesiumNative/CesiumNative/include/rapidjson/document.h:2889:34: note: previous definition is here
typedef GenericDocument<UTF8<> > Document;
^
2 errors generated.
As a workaround, one can apply the following patch to the CesiumNative package in the .o3de/3rdparty/packages/CesiumNative/CesiumNative/include/rapidjson
folder:
diff --git a/fwd.h b/fwd.h.mod
index 77191c5..8f29100 100644
--- a/fwd.h
+++ b/fwd.h.mod
@@ -113,12 +113,12 @@ struct GenericStringRef;
template <typename Encoding, typename Allocator>
class GenericValue;
-typedef GenericValue<UTF8<char>, MemoryPoolAllocator<CrtAllocator> > Value;
+typedef GenericValue<UTF8<> > Value;
template <typename Encoding, typename Allocator, typename StackAllocator>
class GenericDocument;
-typedef GenericDocument<UTF8<char>, MemoryPoolAllocator<CrtAllocator>, CrtAllocator> Document;
+typedef GenericDocument<UTF8<> > Document;
// pointer.h
@@ -149,4 +149,3 @@ typedef GenericSchemaValidator<SchemaDocument, BaseReaderHandler<UTF8<char>, voi
RAPIDJSON_NAMESPACE_END
#endif // RAPIDJSON_RAPIDJSONFWD_H_
-
A proper fix should however either fix the problem in CesiumNative or make the clang compiler accept the typedef redefinition with different types
of rapidjson.
Sorry about that. In regards to the rapidjson errors, at least.
https://github.com/o3de/o3de/pull/13151
Since https://github.com/o3de/o3de/pull/13151 is now merged, this issue should now be resolved. Will verify asap.