Cannot package app

Cannot package app

Hello,

I’m currently trying to package my Unreal app using Cesium but I get packaging error
LNK2005 : “protected: __cdecl tinyxml2::XMLComment::XMLComment(class tinyxml2::XMLDocument *)” (??0XMLComment@tinyxml2@@IEAA@PEAVXMLDocument@1@@Z) already defined in tinyxml2.lib(tinyxml2.obj)"
which seems to happen when using the Unreal nDisplay plugin which is already including tinyxml2.
Could it be possible to change the name of the lib to include to avoid future include conflicts ?

Sincerely yours,

Means you are linking in the same code from two different places.

Yes I understood that, tinyxml is included both in Cesium and inside Unreal Engine with their nDisplay plugin. What can I do to avoid this issue if I still want to package with Cesium ? Thanks.

Hi Jalbert, thanks for your answer, and obviously, the issue comes from the tinyxml2.lib that is imported in Cesium and NDisplay plugin.
The issue is easily reproducable in a new Unreal empty project by enabling Cesium, NDisplay and packaging the project. No code is needed to make it crash.

I assume that we will not be the only ones trying to use Cesium in virtual production context.
Do you have any idea on how we could get around this issue ?

Hello @M003TSkyReal,

Thank you for bringing this to our attention! I’ve created an issue here so that we can track this and hopefully find a solution soon. I’ll also reach out to the engineering team to see if there’s a quick workaround in the meantime.

-Alex

1 Like

Thank you @agallegos,

We asked Epic on our end for a solution in this UDN post and they replied that they’re planning to move tinyxml2 in the engine third party libraries with Unreal 5.1 release. It would then be possible to only include tinyxml once from the engine directory directly.

Thanks again for your feedback.

Hi @M003TSkyReal,

Thanks for following up! Glad to hear they’re working on it - I’ll update the team so that we can improve compatibility when Epic moves the library.

-Alex

1 Like

Do we know if this has been solved in 5.1? I’m having the same issue now.

From one I can tell, tinyxml2 was not moved to the engine third party directory in UE 5.1. It’s still private to nDisplay.

Thank you for double checking. Is there any work around? I really need to package this project.

Hi, our team is also waiting for a way to package our app with cesium.

The only workaround - and I haven’t tried it - would be to make sure Cesium and nDisplay are using the exact same version of tinyxml2. It should be easy enough to recompile Cesium with any particular version, we just need to know which one nDisplay is using. And then hope some other Unreal plugin isn’t using yet another different version of tinyxml2. :laughing:

Hi Kevin, I’m also experiencing this issue. I have located the tinyxml2.lib files in the plugin directories of both ndisplay and Cesium on my computer…is there any way to determine which version is in use by ndisplay or try to get Cesium to link against it?

We upgraded tinyxml2 in Cesium for Unreal v1.22, which was released last week. I’ve heard rumors that this fixes compatibility with nDisplay in UE5.1. Can you confirm? There’s a possibility that it simultaneously broke compatibility with UE5.0, though.

I upgraded my dev machine to both UE 5.1.1 and Cesium plugin v1.22.0 today, and I’m still getting the link error with tinyxml2.

Ok, I just tried this out in UE 5.1.0. I started with the Cesium for Unreal Samples project, enabled the nDisplay plugin, and got the same tinyxml2 errors as you all. Here’s how you can work around it:

Open up C:\Program Files\Epic Games\UE_5.1\Engine\Plugins\Marketplace\CesiumForUnreal\Source\CesiumRuntime\CesiumRuntime.Build.cs and find the line with tinyxml2 on it. It’s line 99 in v1.22.0, but may be different in other versions. Just comment that line out. Like this:

        string[] libs = new string[]
        {
            "async++",
            "Cesium3DTilesSelection",
            "CesiumAsync",
            "CesiumGeometry",
            "CesiumGeospatial",
            "CesiumGltfReader",
            "CesiumGltf",
            "CesiumJsonReader",
            "CesiumUtility",
            "draco",
            "ktx_read",
            //"MikkTSpace",
            "modp_b64",
            "s2geometry",
            "spdlog",
            "sqlite3",
            //"tinyxml2",
            "uriparser",
            "webpdecoder",
            "ktx_read",
        };

Cesium will end up using nDisplay’s version of tinyxml2, which seems to be compatible enough to avoid the linker errors and not have any major problems at runtime.

Let me know how this works for you.

Kevin

Success! Simple and straightforward for me. Thank you so much for your help on this.

To clarify on the solution - does that require re-compiling Cesium from source?

If it doesn’t, I’m stuck on this. I’m using Unreal 5.1 and building using VisualStudio 2022 and have seen the following:

  • Compiles & Runs in the Unreal Editor using Cesium 1.22 - tinyxml2 NOT commented out
  • Compiles and crashes in a cooked ‘DebugGame’ build - tinyxml2 NOT commented out
  • Compiles but the Editor crashes when trying to load - tinyxml2 commented out.
  • Same result using Cesium 1.23
  • Cesium 1.24 - Fails to compile, complaining about these missing symbols: tjInitDecompress, tjDecompressHeader3, tjDecompress2, tjDestroy

Are you compiling the plugin yourself? Or have you installed it from our GitHub releases page or from the Epic Marketplace?

I went back to this, the easiest fix for us was to leave tinyxml included in Cesium only when Target.bBuildEditor is true, so that it is removed when building for shipping

2 Likes