Menu Close

UE4.23.1 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, find or add the following lines :

[/Script/LinuxTargetPlatform.LinuxTargetSettings]
TargetArchitecture=AArch64UnknownLinuxGnueabi
; Possible values for architecture:
;   X86_64UnknownLinuxGnu
;   ArmUnknownLinuxGnueabihf
;   AArch64UnknownLinuxGnueabi

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)
// );
—–

—–
Err:
ERROR: Unhandled exception: System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
Fix:
This happens when you change something on Project Settings and the engine changes your .ini . Edit your UE4Project\Config\DefaultEngine.ini and add TargetArchitecture again.
—-

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

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

Similar

15 Comments

  1. Anonymous

    This reference is greatly appreciated. I’ve been looking for some Nano/ARMUE4-related build process information, and this is exactly what I needed. So glad you left it for others to find! Also, your “about” is empty… on purpose? Man of mystery!

    G

    • DarknessFX

      Yes, you need to install Clang first, then install Clang for Linux Arm, after that you copy the UE4 toolchain to the clang folder.

  2. TetsFR

    Forgot to ask: does the UE audio engine work properly on jetson? Did you try steam audio by any chance?
    Thanks a lot

      • TETSFR

        Any chance you can test the std UE4 audio engine works on jetson? like putting a sound source which plays a .wav or something like that in your blank project template?

          • TetsFR

            Today I did test the std audio engine as well as the UE4 binaural audio engine: both works on Jetson. The binaural audio does emit some cracks though, not sure why (might be cpu thread overload, but that would be surprising and I did not observe a thread consistently at 100%). Will try to reduce the graphics settings and see if that makes the sound better, and/or I will play with the sound buffer to see if that helps or not as well.

  3. Anonymous

    Could you let us know which version of jetpack you were running to get this working? Thanks! Props for getting this info out there 🙂

    • DarknessFX

      I think it was Jetpack 4.29 at that time (Jun/2019) and the board is Jetson Nano Developer Kit B01 4GB. I’m glad it was useful. 🙂

  4. TETSFR

    Sharing a couple more issue I faced but did not see above:

    1) I had an issue while packaging my project with error “ERROR: Cannot use an old toolchain (missing ToolchainVersion.txt file, assuming version earlier than v11)”. I thinkthis error message is related to the issue 3 below, but I did not realize it at the time, so I fixed it the quick and dirty way:
    They mention it here https://answers.unrealengine.com/questions/930647/error-installing-cannot-use-an-old-toolchain-missi.html , but I could not find that structure under my Unreal source tree, so I ended up commenting out the last two lines of function “CheckSDKVersionFromFile” in LinuxToolChain.cs, and replacing them with some placeholder instructions to keep the program happy:
    protected bool CheckSDKVersionFromFile(string VersionPath, out string ErrorMessage)
    {
    if (File.Exists(VersionPath))
    {
    StreamReader SDKVersionFile = new StreamReader(VersionPath);
    string SDKVersionString = SDKVersionFile.ReadLine();
    SDKVersionFile.Close();

    if (SDKVersionString != null)
    {
    return PlatformSDK.CheckSDKCompatible(SDKVersionString, out ErrorMessage);
    }
    }

    ErrorMessage = “skipping toolchain check!”;
    return true;
    //ErrorMessage = “Cannot use an old toolchain (missing ” + PlatformSDK.SDKVersionFileName() + ” file, assuming version earlier than v11)”;
    //return false;

    2) My compiled from source UE4.23.1 would not want to build lightning of my project in the UI because UnrealLightmass was not compiled for some reason, even after compiling the full UE4 project in VS (I use VS2017). So I did follow this video, it did work just fine for me: https://www.youtube.com/watch?v=zv97nid152w

    3) One comment on the ““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.” error you mentioned above: this happens because UE cross compilation toolchain you install contains clang version 5.0 for ARM, i.e. v11 of the toolchain. However on the Epic website they mention one should install v15 of the toolchain with UE4.23:
    https://docs.unrealengine.com/en-US/SharingAndReleasing/Linux/GettingStarted/index.html
    -> Is there a reason why you installed v11 of the toolchain (with ARM clang v5.0) instead of version 15 (with CARM clang v8.0) as suggested by Epic?

    I am still trying to package my project, getting some mysterious error, I may try to re-install with v15 of the cross compilation toolchain:
    LogUObjectHash: Compacting FUObjectHashTables data took 0.66ms
    UATHelper: Packaging (Linux): Running AutomationTool…
    UATHelper: Packaging (Linux): Parsing command line: -ScriptsForProject=D:/Projects/unreal/Test02/Test02.uproject BuildCookRun -nocompileeditor -nop4 -project=D:/Projects/unreal/Test02/Test02.uproject -cook -stage -archive -archivedirectory=D:/Projects/unreal/Test02 -package -clientconfig=Development -ue4exe=D:\Unreal\UE_4.23\Engine\Binaries\Win64\UE4Editor-C
    md.exe -pak -prereqs -nodebuginfo -targetplatform=Linux -build -utf8output -compile
    UATHelper: Packaging (Linux): Dependencies are up to date. Skipping compile.
    UATHelper: Packaging (Linux): Setting up ProjectParams for D:\Projects\unreal\Test02\Test02.uproject
    UATHelper: Packaging (Linux): ********** BUILD COMMAND STARTED **********
    UATHelper: Packaging (Linux): Running: D:\Unreal\UE_4.23\Engine\Binaries\DotNET\UnrealBuildTool.exe UnrealPak Win64 Development -NoUBTMakefiles -Manifest=D:\Unreal\UE_4.23\Engine\Intermediate\Build\Manifest.xml -NoHotReload -log=”D:\Unreal\UE_4.23\Engine\Programs\AutomationTool\Saved\Logs\UBT-UnrealPak-Win64-Development.txt”
    UATHelper: Packaging (Linux): Writing manifest to D:\Unreal\UE_4.23\Engine\Intermediate\Build\Manifest.xml
    UATHelper: Packaging (Linux): Target is up to date
    UATHelper: Packaging (Linux): Total execution time: 2.67 seconds
    UATHelper: Packaging (Linux): Took 2.9498617s to run UnrealBuildTool.exe, ExitCode=0
    UATHelper: Packaging (Linux): Running: D:\Unreal\UE_4.23\Engine\Binaries\DotNET\UnrealBuildTool.exe UE4Game Linux Development -NoUBTMakefiles -remoteini=”D:\Projects\unreal\Test02″ -skipdeploy -Manifest=D:\Unreal\UE_4.23\Engine\Intermediate\Build\Manifest.xml -NoHotReload -log=”D:\Unreal\UE_4.23\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Game-Linux-D
    evelopment.txt”
    UATHelper: Packaging (Linux): ——- Build details ——–
    UATHelper: Packaging (Linux): Using toolchain located at ‘D:/Unreal/clang8/aarch64-unknown-linux-gnueabi’.
    UATHelper: Packaging (Linux): Using clang (D:/Unreal/clang8/aarch64-unknown-linux-gnueabi\bin\clang++.exe) version ‘5.0.0’ (string), 5 (major), 0 (minor), 0 (patch)
    UATHelper: Packaging (Linux): Using compiler default (most likely libstdc++) standard C++ library.
    UATHelper: Packaging (Linux): Using default linker (ld)
    UATHelper: Packaging (Linux): Using llvm-ar : D:/Unreal/clang8/aarch64-unknown-linux-gnueabi\bin/llvm-ar.exe
    UATHelper: Packaging (Linux): Using old way to relink circularly dependent libraries (with a FixDeps step).
    UATHelper: Packaging (Linux): ——————————
    UATHelper: Packaging (Linux): Writing manifest to D:\Unreal\UE_4.23\Engine\Intermediate\Build\Manifest.xml
    UATHelper: Packaging (Linux): Target is up to date
    UATHelper: Packaging (Linux): Total execution time: 2.51 seconds
    UATHelper: Packaging (Linux): Took 2.6100346s to run UnrealBuildTool.exe, ExitCode=0
    UATHelper: Packaging (Linux): BUILD FAILED: D:\Unreal\UE_4.23\Engine\Binaries\Linux\UE4Game.debug was in manifest but was not produced.
    UATHelper: Packaging (Linux): AutomationTool exiting with ExitCode=1 (Error_Unknown)
    UATHelper: Packaging (Linux): BUILD FAILED
    PackagingResults: Error: Unknown Error

    • DarknessFX

      Great contribution, I still have that UnrealLightmass error happening in my current UE4.23.1 builds, going to watch the video you linked to fix it too.

      -> Is there a reason why you installed v11 of the toolchain (with ARM clang v5.0) instead of version 15 (with CARM clang v8.0) as suggested by Epic?

      At that time, the v11 was the latest toolchain available. UEDocs later (I think it was when UE4.26 launched) update the cross compilation page with more Linux Arm toolchains for each UE4 version.

      -> UE4Game.debug was in manifest but was not produced.

      Looks like you compiled your UE4 editor as Debug, I think it should be Development. The game can be packaged as debug without problems but not the editor.

      • TetsFR

        Yes you are right, I most likely compiled the editor in debug mode, but after replacing the toolchain with v15, and fixing the the infamous error “PackagingResults: Error: expected ‘)’” thanks to your great tip, it did compile successfully! I think I feel brave enough to try to compile v4.24 or even 4.26 now.
        At some point I thought that it was not necessary to compile the engine frome source anymore, but I could not successfully package my linux arm package with the precompiled editor binaries + toolchain. Only compiling from source worked out so far, but I am not sure why.
        Next step for me is to check if the std audio works (it should, but I did not test it yet). What I did test already though is that SteamAudio plugin has no linux target plateform, same for the Occulus audio plugin, however Google Resonance has a linux target but it requires to be built from source along with the editor, so I keep that attempt for a bit later.

        Thanks for your great page here, it has been really helpful! If you are interested to help me test spatialized sound plugins working on thebjetson we can share some testing 🙂

Comments are welcome.