Cross-Compiling for Linux (Legacy)

For engine versions older than 4.14, this page shows users how to set up cross-compilation for the Linux Platform.

Windows
MacOS
Linux

This reference is an archive for users who need to set up their cross-compilation toolchains in Unreal Engine 4 (UE4) versions that were released prior to 4.14.

If you're developing your project with Unreal Engine, version 4.14 (or newer), you'll want to refer to our Cross-Compiling for Linux documentation.

Why Cross-Compilation

Cross-compilation makes it possible for game developers, working in a Windows-centric workflow, to target Linux. At this time, cross-compilation is only supported for Windows. Mac users currently have to resort to native compilation. We support, test, and provide the libraries and toolchains for the Linux-x86_64 platform.

Getting the Toolchain

Please use the following table to download the appropriate toolchain:

UE4 Version

Toolchain

4.23

-v14 clang-8.0.1-based

4.22

-v13 clang-7.0.1-based

4.21

-v12 clang-6.0.1-based

4.19 and 4.20

-v11 clang-5.0.0-based

4.18

-v10 clang-5.0.0-based

4.16 and 4.17

-v9 clang-4.0.0-based

4.14 and 4.15

-v8 clang-3.9.0-based

4.11 thru 4.13

-v7 clang-3.7.0-based

4.9 and 4.10

-v6 clang-3.6.0-based

4.8 and earlier

-v4 clang-3.5.0-based

  • For toolchains -v8 through -v13 , there is no need to extract files or set the environment variable — just run the installer package.

  • For toolchains -v4 through -v7, we also provide the libraries and toolchains that enable you to compile for Linux ARM (original Raspberry Pi and up).

    • Note that this will require you to make a (minor) code change in UnrealBuildTool (UBT).

  • We currently have driver support for AMDGPU-PRO (not RADV) for users running Unreal Engine on CentOS.

From this point on, we assume that you are targeting x86_64 Linux, though most of the following information will apply to compiling for ARM as well (except for the different toolchain). Note that you can build your own toolchain if you want different versions of the tools, or if you want to target a different architecture.

Setting up the Toolchain

Add an environment variable named LINUX_ROOT, the value of which is the absolute path to your toolchain (without a trailing backslash):

Control Panel->System->Advanced system settings->Advanced->Environment variables 

After you make sure that the environment variable is set, regenerate UE4 project files (using GenerateProjectFiles.bat) and restart Visual Studio. After this, you should have "Linux" available for Win32/Win64 configurations, and you should now be able to cross-compile for it.

Setting up Packaging for Linux

Note that binary release can only package content-only projects. If you want to package a code-based project for Linux (or a project that has non-default third party plugins), you will have to set up a source build. Otherwise, if you are fine with content-only, there's no need to build anything because Linux binaries of UE4Game and CrashReportClient are bundled.

To package for the Linux platform, you will need to build the following targets:

For Linux:

  • CrashReportClient

  • UE4Game (if you project is content-only, otherwise just build your project)

For Windows:

  • The editor itself (this is needed to get Linux target modules built, so that Unreal Editor and Unreal Frontend know how to cook/package games for Linux).

  • UnrealPak and ShaderCompileWorker (you probably have those built anyway, but we're still mentioning it for completeness).

Packaging for Linux

The easiest way to package a project is to open it in the editor and then select File > Package To > Linux. This assumes that you have a cross-toolchain installed in the previous step, and Linux target modules are built for the editor in question. If you don't see Linux in the list, then it's likely that one of the former is not true, in which case see above. After some time (which depends on the project in question and is rather short for a sample project) you will have game assets and binaries in the directory you chose to package to.

The details of the packaging process can be seen by clicking the Show Output Log link. If this process fails with the error message, "unable to find UnrealPak or ShaderCompileWorker" see above about building them for the host (Windows) platform.

Secure copy (scp) or otherwise copy it to a target machine (mounting a Samba share - if you know how to do that - may be better if the target machine is low on disk space, which also reduces iteration times). Change mode (chmod +x) for the target executable, (which will be located in the LinuxNoEditor/<ProjectName>/Binaries/Linux/ directory) and run it.

Changes for Linux-ARM Platforms

With the release of Unreal Engine, version 4.14, there is a new (and easy to follow) way of packaging projects for the ARM platform. Check out our recently updated Cross-Compiling for Linux documentation to learn more.

If you are using the Linux-ARM cross compile toolchain before running GenerateProjectFiles.bat below, edit the following file in the UE4 source code:

.../UnrealEngine/Engine/Source/Programs/UnrealBuildTool/Linux/UEBuildLinux.cs 

by commenting out the following line:

static private string DefaultArchitecture = "x86_64-unknown-linux-gnu"; 

and un-commenting the linux-arm architecture line just below it:

//static private string DefaultArchitecture = "arm-unknown-linux-gnueabihf";

An additional step is required for the packaged project to be runnable on Linux-ARM platforms. Assuming the packaged project is located at \foo\bar\SunTemple_Linux, open the following location:

\foo\bar\SunTemple_Linux\LinuxNoEditor\Engine\Binaries\Linux

and replace libopenal.so.1 with the version from:

...\UnrealEngine\Engine\Source\ThirdParty\OpenAL\1.15.1\lib\Linux\arm-unknown-linux-gnueabihf\libopenal.so

where ...\UnrealEngine is the location of the UE4 source code. Please be sure to rename libopenal.so to libopenal.so.1.

Now the project can be copied over to the target machine, chmod+x the target executable and run it as instructed above.

Tags
Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback