Missing reference to LowLevelTasks::FTask::ActiveTask in android build

Hi!

We’re updating our project to UE 5.6.1 and we’re having an issue when building for android. At some point in our code we are enqueuing tasks in order to be processed in the background, with a code like this

void Ourclass::EnqueueTask(std::function<void()> Task)
{
    AsyncFutures.Add(Async(EAsyncExecution::TaskGraphMainThread,
        [Task]() {
            Task();
        }));
}

When building for other platforms, we’ve no problems, but when building for android we’re getting:

ld.lld: error: undefined symbol: LowLevelTasks::FTask::ActiveTask
>>> referenced by Task.h:371 (Runtime/Core/Public/Async/Fundamental/Task.h:371),

trailing to our method

We’ve cleared all intermediate files. We’ve updated to ndk29, and we’re using the android sdk34.

Are we missing something?

Thanks.

Hi Emilio,

I integrated your code in a sample project and built with NDK r29 without issue on the stock 5.6.1 release. Confirmed the presence of LowLevelTasks::FTask::ActiveTask in the generated binary. Are you able to share a repro project of this issue or additional details on your project setup and how this code is referenced?

Best regards.

Hi Stéphane.

I’ve tried to build our project from the editor in 5.6.1 and everything builds smoothly, but for our CI, we’re building using the command line, and it’s there when the error happens.

our command line arguments are:

RunUAT.bat BuildCookRun -project=<project> -platform=android -clientconfig=Shipping -serverconfig=Shipping -target=<projectTarget> -build -cook -stageEdit:

After posting this, something clicked. I’ve tried with the editor a little bit more. Using the Development and DebugGame configurations, it builds correctly, but it’s when we use the Shipping one that the compilation fails.

Tried the same with the command line with the exact same results as the editor. So it fails when the shipping configuration is set, no matter the build method.

Regards.

Hi Emilio,

Still builds successfully on my side (both Editor and command line) against the Shipping configuration. Have you tried wiping the Intermediate/Build/Binaries folders to make sure there aren’t stale object files?

Best regards.

HI Stéphane.

Yes, we’ve cleaned our Intermediate, Saved folders and even tried to delete the previous project folder from the CI and was still happening.

But I’ve another idea. This code is part of a module inside a plugin, not part of the main application. We use UPL to setup some stuff on the android build, but we’re not removing anything on the proguard additions sections of the xml.

Also, I just noticed, our class declaration is private, not public, and that’s make me think that it could also be the potential issue.

I’ll try to replicate this issue in a small project, to check if any of these theories are right.

Regards.

Hi Stéphane.

We’ve been able to isolate the problem. I’ve attached a sample project that is able to reproduce the issue. If we build for android with Developemnt or DebugGame configurations, it builds perfectly, but if we use Shipping, the Task class is missing.

I have checked the theories from the previous post, and it’s still failing even if I set the private classes as public.

The project structure is similar to the one having the problem. It is as follows:

  • TaskPlugin (Plugin):

Contains the class TaskBackgroundWork, that have the reference to the LowLevelTasks::FTask::ActiveTask property.

  • PluginB (Plugin):

Contains the CallBackground class, this class references the class TaskBackgroundWork from the TaskPlugin

  • AndroidTask (Game):

Contains the MyGameInstanceSubsystem class containing a reference to the CallBackground class from PluginB. If we remove the reference from here, it will build correctly.

The project building correctly when we use the debug/development settings and the upgrade to cpp20 makes me wonder if the shipping configuration have some flag changes that causes the dependency to be lost.

Regards.

Hi Emilio,

Thanks for the repro case. It appears the combination of this plugin setup along with the prebuilt launcher binaries may be causing issues with the linker. I’ve not fully found the cause, however, can confirm the issue doesn’t occur running off the 5.6.1 source build. One potential workaround could be to provide the definition of the symbol in the TaskPlugin in TaskMainThread.cpp form instance:

#if PLATFORM_ANDROID //&& UE_BUiLD_SHIPPING
namespace LowLevelTasks
{
	thread_local FTask* FTask::ActiveTask = nullptr;
}
#endif

however, I’ll report back if we can find the root cause of this issue in the Launcher distribution.

Best regards.

Hi Stéphane.

As you pointed, this is not an issue with the source code distribution, and your workaround works with the prebuilt binaries.

Looking forward to the fix on the prebuild binaries.

Regards.

Thank you for confirming the workaround are good on your end. We do not foresee future patches for 5.6 however, we will regress this against future releases.

Best regards.