Menu Close

UE4 packaging to Linux ARM

This are my old notes about “HowTo_UE4_LinuxArm64.txt”, I’m saving and sharing here if anyone else wants to try.

Pre-requisites:
You need access to Unreal Engine 4.23.1 Source Code, download it and build it one time to assure everything is working. I used the path D:\Unreal\UE_4.23 .

Reference and additional info:
I used this tutorial, it’s outdated and it breaks with newer UE4 versions:
https://www.ue4community.wiki/Legacy/Compiling_For_Linux#Additional_Step_for_Linux-ARM_platforms
https://nerivec.github.io/old-ue4-wiki/pages/compiling-for-linux.html (backup link)

Preparing to cross-compile to Linux ARM :
Install the full CLang8 from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/LLVM-8.0.1-win64.exe .
I used the path D:\Unreal\clang8 . Be careful with spaces on your folder name or paths because it can cause troubles later.

Install the additional CLang8 package for Linux ARM architeture from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/clang+llvm-8.0.1-armv7a-linux-gnueabihf.tar.xz
Unzip all folders (bin, include, lib, etcs) to clang8\arm-unknown-linux-gnueabihf .
Duplicate the arm-unknown-linux-gnueabihf to another folder named aarch64-unknown-linux-gnueabi .

Download the Unreal Engine 4 Linux-x86_64 cross compile toolchain binaries from http://cdn.unrealengine.com/CrossToolchain_Linux/v11_clang-5.0.0-centos7.zip
Unzip and copy arm-linux-gnueabihf to clang8\arm-unknown-linux-gnueabihf .
Unzip and copy aarch64-unknown-linux-gnueabi to clang8\aarch64-unknown-linux-gnueabi .
Overwrite duplicates.

Change UE4.23.1 Source:
File :
…/UnrealEngine/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/UEBuildLinux.cs
VSSolutionExplorer :
[Solution/Programs/UnrealBuildTool/Platform/Linux]

Change the following lines:
static private string DefaultArchitecture = “x86_64-unknown-linux-gnu”;
TO:
//static private string DefaultArchitecture = “x86_64-unknown-linux-gnu”;

//static private string DefaultArchitecture = “aarch64-unknown-linux-gnueabi”;
TO:
static private string DefaultArchitecture = “aarch64-unknown-linux-gnueabi”;

Build UnrealBuildTool with this changes.
Change aarch64-unknown-linux-gnueabi to arm-unknown-linux-gnueabihf if you want to build packages to Linux Arm 32bits OS (like Raspberry Pi, Asus Thinkerboard and others SBCs).

Change your UE4 Project:
Edit your UE4Project\Config\DefaultEngine.ini :
Change TargetArchitecture to TargetArchitecture=AArch64UnknownLinuxGnueabi
Or TargetArchitecture=ArmUnknownLinuxGnueabihf (for Linux Arm 32bits OS).

Right-click your UE4Project .project file , “Switch Unreal Engine Version” and make sure it’s using your UE4 compiled source code.

Change your Enviroment Variables:
Create an environment variable LINUX_MULTIARCH_ROOT with the folder path to your clang++ v8 directory containing the multiple linux architecture directories.
Create an environment variable of UE4_LINUX_USE_LIBCXX to 0.

Reboot your PC.

Test:
Try to package your project to Linux in UE4.
If everything worked, it will create an Linux Arm64 package.
If something fails, read the Errors and Fixes below.

Performance:
If you turn off AmbientOcclusion and do some tweaks on scalability settings , set the resolution to 720p (ex: 1080p fullscreen set r.ScreenPercentage to 50) it can run Unreal Engine blank project template at 60fps on Nvidia Jetson Nano .

Nvidia Jetson Nano UE4LinuxArm64Vulkan screenshot

Sample UE4LinuxArm64 Vulkan:
Download here . (73.8 MB)
This sample only works with Linux Arm64 OS with Vulkan drivers (ex: Nvidia Jetson Nano and other Nvidia Jetsons). It doesn’t run on Raspberry PI (yet) because the new Vulkan Driver is currently working only on Linux Arm32 OS.

Any sample for LinuxArm32 or LinuxArm64 with OpenGL to test on Raspberry PI?
Not yet. My PC power supply died while I was upgrading my nvme to 1TB… Bad luck… It will take a few weeks before I’m able to try to reinstall everything and apply this instructions again.

Errors and Fixes:
—–
Err: Third-party or plugin errors:
Fix: Duplicating the Third-party linux_x86 folders to linux_arm64 copies.
—–

—–
Err:
==
UATHelper: Packaging (Linux): [236/372] Module.Core.6_of_11.cpp
UATHelper: Packaging (Linux): D:/UnrealEngine/Engine/Source/Runtime/Core/Private/Misc/AutomationTest.cpp(1074,27): note: to match this ‘(‘
UATHelper: Packaging (Linux): AddError(FString::Printf(TEXT(“Expected ‘%s’ to be %” PRId64 “, but it was %” PRId64 “.”), What, Expected, Actual), 1);
UATHelper: Packaging (Linux): ^
UATHelper: Packaging (Linux): 1 error generated.
PackagingResults: Error: expected ‘)’
UATHelper: Packaging (Linux): [237/372] Module.Core.9_of_11.cpp
==
Fix:
Find and change the bold line to
AddError(FString::Printf(TEXT(“Expected ‘%s’ to be %d, but it was %d.”), What, Expected, Actual), 1);
—–

—–
Err:
“This version of the Unreal Engine can only be compiled with clang 8.0, 7.0 and 6.0. clang {0} may not build it – please use a different version.”
Fix:
Comment LinuxToolChain.cs lines 180:
//throw new BuildException(
// string.Format(“This version of the Unreal Engine can only be compiled with clang 8.0, 7.0 and 6.0. clang {0} may not build it – please use a different version.”,
// CompilerVersionString)
// );
—–

Additional references:
Not exactly LinuxARM but this video cover almost the same process described here:

How to Cross-Compile for Linux in Unreal Engine - Setting up the Toolchain
Watch this video on YouTube.

PS: To the person at Epic Games that maintains Linux ARM on Unreal Engine, you’re my hero||heroine!

Comments are welcome.

Similar

%d bloggers like this: