I’m getting a bunch of compile errors similar to this one when I try to compile the cesium plugin for UE4.27:
error C4582: ‘std::Variant_storage<true,CesiumGltf::MetadataArrayView<int8_t>,CesiumGltf::MetadataArrayView<uint8_t>,CesiumGltf::MetadataArrayView<int16_t>,CesiumGltf::MetadataArrayView<uint16_t>,CesiumGltf::MetadataArrayView<int32_t>,CesiumGltf::MetadataArrayView<uint32_t>,CesiumGltf::MetadataArrayView<int64_t>,CesiumGltf::MetadataArrayView<uint64_t>,CesiumGltf::MetadataArrayView,CesiumGltf::MetadataArrayView,CesiumGltf::MetadataArrayView,CesiumGltf::MetadataArrayViewstd::string_view>::_Tail’: constructor is not implicitly called
This warning is treated as an error by Unreal. I tried searching these forums for anyone mentioning this problem but haven’t found anything. More info: I’m building the soucre code from the 'ue4-main" branch.
git clone --recursive GitHub - CesiumGS/cesium-unreal: Bringing the 3D geospatial ecosystem to Unreal Engine --branch “ue4-main”
How do I resolve this? I tried disabling this error in WindowsPlatformCompilerSetup.h but then I still get some link errors:
46>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2019: unresolved external symbol __dyn_tls_on_demand_init referenced in function "public: __cdecl <lambda_add1bab61293464c9cf45edd8d6d3858>::operator()(void)const " (??R<lambda_add1bab61293464c9cf45edd8d6d3858>@@QEBA@XZ)
46>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2001: unresolved external symbol __tls_guard
46>s2geometryd.lib(s2cell_id.cc.obj) : error LNK2019: unresolved external symbol __imp___std_init_once_begin_initialize referenced in function “void __cdecl std::call_once<class <lambda_79ba321403081603635db02b57b3fb8e> >(struct std::once_flag &,class <lambda_79ba321403081603635db02b57b3fb8e> &&)” (??$call_once@V<lambda_79ba321403081603635db02b57b3fb8e>@@$$V@std@@YAXAEAUonce_flag@0@$$QEAV<lambda_79ba321403081603635db02b57b3fb8e>@@@Z)
46>s2geometryd.lib(s2cell_id.cc.obj) : error LNK2019: unresolved external symbol __imp___std_init_once_complete referenced in function “public: __cdecl std::_Init_once_completer::~_Init_once_completer(void)” (??1_Init_once_completer@std@@QEAA@XZ)
Thanks in advance for any help!
Hello, those errors look similar to when I build using VS2022 instead of VS2019.
Interesting! Do you have to disable the C4582 warning to compile Cesium for Unreal?
I don’t actually have VS2022. Only 2017,2019 and VSCode. I have updated VS2019 to the latest version as of today.
No, I’ve never disabled any warnings.
Not sure, I would try to somehow compile with an earlier version, maybe 2017? Of course regenerating the solution files via cmake.
By any chance are you compiling for Unreal 5? I’m compiling for 4.27 and I see that in the latest Unreal 5 code, they have disabled the warning that I’m getting (C4582)
https://github.com/EpicGames/UnrealEngine/commit/4f5ae1338338516356436301bc02af1187372b47
Yes I’m using Unreal 5.
Here’s a reference to a similar looking error: Packaging Error (s2geometry.lib)
This link made me think the problem is related to our project somehow getting compiled with visual studio’s v141 tools.
https://developercommunity.visualstudio.com/t/-dyn-tls-on-demand-init-and-tls-guard-related-weir/1010557
Since Unreal uses a build system that generates your vcxproj file, I looked into our vcxproj files using a text editor and it looks like we’re compiling with v142.
I have reproduced the linker errors using a stock install of Unreal 4.27.2, windows, Visual studio 2019.
46>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2019: unresolved external symbol __dyn_tls_on_demand_init referenced in function "public: __cdecl <lambda_add1bab61293464c9cf45edd8d6d3858>::operator()(void)const " (??R<lambda_add1bab61293464c9cf45edd8d6d3858>@@QEBA@XZ)
46>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2001: unresolved external symbol __tls_guard
46>s2geometryd.lib(s2cell_id.cc.obj) : error LNK2019: unresolved external symbol __imp___std_init_once_begin_initialize referenced in function “void __cdecl std::call_once<class <lambda_79ba321403081603635db02b57b3fb8e> >(struct std::once_flag &,class <lambda_79ba321403081603635db02b57b3fb8e> &&)” (??$call_once@V<lambda_79ba321403081603635db02b57b3fb8e>@@$$V@std@@YAXAEAUonce_flag@0@$$QEAV<lambda_79ba321403081603635db02b57b3fb8e>@@@Z)
46>s2geometryd.lib(s2cell_id.cc.obj) : error LNK2019: unresolved external symbol __imp___std_init_once_complete referenced in function “public: __cdecl std::_Init_once_completer::~_Init_once_completer(void)” (??1_Init_once_completer@std@@QEAA@XZ)
The last version of Cesium for Unreal that supported UE 4.27 was v1.24.0, which was released over 6 months ago. You can download old versions from our releases page if you want to use them without going through the trouble of building them yourself:
But a lot has already changed in the plugin in that time, and it’s only going to become more obsolete over time. I think your time would almost certainly be better spent upgrading your project to UE 5.x rather than fighting with the build process of an ancient and unsupported version of Cesium for Unreal.