Packaging Error (s2geometry.lib)

Hi,

I just updated to a new Windows 11 machine, when trying to package a project (that packaged correctly in windows 10) I get the following error:

UATHelper: Packaging (Windows): Creating library C:\UEProjects\Viewer3D_UE5\Binaries\Win64\Viewer3D_UE5.lib and object C:\UEProjects\Viewer3D_UE5\Binaries\Win64\Viewer3D_UE5.exp
UATHelper: Packaging (Windows): s2geometry.lib(s2cell_id.obj) : error LNK2019: unresolved external symbol __imp___std_init_once_begin_initialize referenced in function “void __cdecl MaybeInit(void)” (?MaybeInit@@YAXXZ)
UATHelper: Packaging (Windows): s2geometry.lib(s2cell_id.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)
UATHelper: Packaging (Windows): C:\UEProjects\Viewer3D_UE5\Binaries\Win64\Viewer3D_UE5.exe : fatal error LNK1120: 2 unresolved externals

A quick search for s2geometry.lib shows me it’s from the Cesium plugin here: …\UE_5.0\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\lib\Windows-x64

I tried reinstalling the Cesium plugin several times and also using the Verify option from the Epic Games Launcher, but can’t seem to fix this. I’m running UE 5.0.2.

Any suggestions are greatly appreciated.

Hi @JulianCrespi,

I haven’t seen that error before, but the first thing I’d check is that your Visual Studio 2019 installation is up-to-date. It’s possible an older version of the compiler might have trouble linking binaries (like s2geometry.lib) built with a newer version.

By the way, are you installing the Cesium for Unreal plugin from the Marketplace, or have you installed it some other way?

Kevin

Actually, it looks like this may be a breaking change in some versions of Visual Studio 2022. There’s a thread about it here, including a possible workaround (a few posts up from the one linked):
https://developercommunity.visualstudio.com/t/-imp-std-init-once-complete-unresolved-external-sy/1684365#T-N10047968

So if you have Visual Studio 2022 installed, make sure that is up-to-date as well. And it may be worth installing VS2019 and configuring UE to prefer it over the newer compiler.

1 Like

Hi Kevin thanks!

Yes it was a Visual Studio error, reverting to 2019 fixed it.