Unreal Engine stuck on startup if uses 3rd party library

Summary

I am trying to compile Unreal Engine project with a third party C++ library: dealii. I managed to make it compile with dealii, however when I am running the engine it gets stuck on:

Loading PreDefault Module for Plugin: <PluginName>

The most confusing thing is that it stops on random plugins each time - so not plugin related.

And another pointer: it only gets stuck on loading if there is at least one member variable from dealii existing on some class. If I just #include a header it loads just fine.

Please select what you are reporting on:

Engine

What Type of Bug are you experiencing?

Engine

Steps to Reproduce

  1. Compile dealii for Windows. Personally am compiling with the following vscode settings.json:
{
    "cmake.sourceDirectory": "<folder>/dealii",
    "cmake.buildDirectory": "<folder>/dealii_install",
    "cmake.configureArgs": [
        "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
        "-DCMAKE_BUILD_TYPE=Release",
        "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL",
        "-DCMAKE_INSTALL_PREFIX=${workspaceFolder}/dealii_install",
        "-DDEAL_II_CXX_FLAGS=/MD",
    ],
}
  1. Add the following parameters to make dealii compile:
    Add this to Target.cs:
        bOverrideBuildEnvironment = true;
        AdditionalCompilerArguments += "/EHsc /bigobj /wd4668 /wd4068 /wd4244 /wd4267 /wd4996 /wd4355 /wd4800 /wd4146 /wd4667 /wd4520 /wd4700 /wd4789 /wd4808 /wd5037";

Add this to build.cs:

PublicIncludePaths.Add("<Folder>/dealii_install/include");
PublicIncludePaths.Add("<Folder>/dealii_install/include/deal.II/bundled");
PublicAdditionalLibraries.Add("<Folder>/dealii_install/lib/deal_II.lib");
PublicDefinitions.Add("KOKKOS_COMPILER_CUDA_VERSION=1");
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS=1");
PublicDefinitions.Add("BOOST_ALL_NO_LIB=1");
bUseRTTI = true;
  1. Create an empty C++ class with following:
#undef PI
#undef check

#include <deal.II/lac/sparse_matrix.h>

And then add the following private variable to the class:
dealii::Vector<double> sampleVector;
4. Compile and run the editor

Expected Result

Editor loads

Observed Result

Editor loading should get stuck at:

Loading PreDefault Module for Plugin:

Platform(s)

Windows

Possibly related: In debug console (when running the Editor in VSCode) last debug output log is:

UnrealEditor-Win64-DebugGame.exe (31716): Loaded 'D:\Projects\MagixSmith\Binaries\Win64\UnrealEditor-MagixSmith-Win64-DebugGame.dll'. Symbols loaded.
Unloaded 'D:\Projects\MagixSmith\Binaries\Win64\UnrealEditor-MagixSmith-Win64-DebugGame.dll'.
UnrealEditor-Win64-DebugGame.exe (31716): Loaded 'D:\Projects\MagixSmith\Binaries\Win64\UnrealEditor-MagixSmith-Win64-DebugGame.dll'. Symbols loaded.

Where MagixSmith is my projects name (WIP)

Another finding: the code seems to be stuck on tf::Executor constructor → tf::Latch::arrive_and_wait

OK seems like the crux of the issue is that dealii library uses taskflow library, and creates tf::Executor class during DLL loading / initiailization.

Then tf::Executor tries spawning workers, and waits for all workers to be created… But it looks like workers might not be created, creating a deadlock. Anyway, will try looking into it a bit more - seems like tf library is just not compatible with the way Unreal Engine loads the library.

This topic was automatically closed after 180 days. New replies are no longer allowed.